2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2023-11-08 12:57 PM - edited 2023-11-09 05:55 AM
Hello team,
Solved! Go to Solution.
2023-11-10 08:11 AM
Hi,
1. If you know the name of the door, then you can use ACAPI_LibPart_Search()
to find the index of that library part, then get that library part's parameters as well with ACAPI_LibPart_GetParams()
.
Put the index into the openingBase.libInd
member of API_WindowType
, and add the library part parameters to addPars
in API_ElementMemo, then call ACAPI_Element_Create()
.
2. There are several ways to do that:
ACAPI_LibraryManagement_AddLibraries()
Best, Akos
2023-11-10 08:11 AM
Hi,
1. If you know the name of the door, then you can use ACAPI_LibPart_Search()
to find the index of that library part, then get that library part's parameters as well with ACAPI_LibPart_GetParams()
.
Put the index into the openingBase.libInd
member of API_WindowType
, and add the library part parameters to addPars
in API_ElementMemo, then call ACAPI_Element_Create()
.
2. There are several ways to do that:
ACAPI_LibraryManagement_AddLibraries()
Best, Akos
2023-11-10 08:17 AM
Thank you @Akos Somorjai . Will try this out.
2023-11-10 08:19 AM
There is a Do_CreateWindow() sample code in Element_Test; this may serve as a starting point.
Best, Akos
2023-11-22
12:14 PM
- last edited on
2023-11-23
12:11 AM
by
Laszlo Nagy
@Akos Somorjai For point 2. Is it possible to add the library file(.lcf) as part of the .bundle or .apx and provide code to load from the file included in the add-on bundle. I was able to load the library given a location from where to pick it up. Something mentioned in this documentation of ArchiCAD 25. Am I looking for something that is not possible to be done.
2023-11-22 05:08 PM
Hi kency,
No, you may only add individual .gsm files as resources. You may ship an .lcf file with the add-on, but then you'll have to add it from code with ACAPI_Environment (APIEnv_AddLibrariesID, ...).
Best, Akos
2023-11-23 06:51 AM
Ok, maybe I am stuck at something really simple. I have added an .lcf file in the Resources folder of the Add-On. (updated cmake to include .lcf files).
Now,
How should I ship/bundle it? Is there anything additional that needs to be done for that.
Also, how can I refer to that file in the code? Right now I have been able to load from an absolute path as shown in the snippet below.
GSErrCode CreateLibrary (void)
{
IO::Location newLib("~/Desktop/libraries.lcf");
GSErrCode err;
err = ACAPI_Environment (APIEnv_AddLibrariesID, &newLib);
if (err == NoError){
std::cout << "New library has been loaded" << std::endl;
}
return err;
}
Thank you!
2023-11-23 03:07 PM
Hi,
I would ship it together with the add-on, but as a separate file. Ask the user to place the two together into a folder, and then from your code you can get the add-on's location in the file system with ACAPI_GetOwnLocation() and load the .lcf from there.
Best, Akos