a month ago - last edited 4 weeks ago
Hello team,
Solved! Go to Solution.
4 weeks ago
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
4 weeks ago
Thank you @Akos Somorjai . Will try this out.
4 weeks ago
There is a Do_CreateWindow() sample code in Element_Test; this may serve as a starting point.
Best, Akos
2 weeks ago
- last edited
2 weeks ago
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.
2 weeks ago
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
2 weeks ago
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!
2 weeks ago
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