2023-12-06 07:17 AM - last edited on 2024-09-16 02:44 PM by Doreena Deng
Hi All,
I was trying to register a list of libParts, later to create Surfaces using them.
GS::Array<API_LibPart> libParts;
for (const auto& location : textureFileNewLocationList) {
IO::Location nonConstLocation = location;
std::cout<<UNISTR_TO_LIBXLSTR(nonConstLocation.ToDisplayText()) << std::endl;
API_LibPart libPart;
BNZeroMemory (&libPart, sizeof (API_LibPart));
libPart.typeID = APILib_PictID;
libPart.location = &nonConstLocation;
libParts.Push (libPart);
}
err = ACAPI_LibPart_RegisterAll (&libParts);
In the above code textureFileNewLocationList is a array of file locations of images I plan to use. After executing the code, it registers only the last element of the array. In my case I have 55 libParts to register, only 55th have successfully registered.
If I go and check Files → Library and Objects → Library Manager, the box will show one surface got loaded, other 54 were missing.
A manual Reload in the ArchiCAD will load all the libParts
Using ArchiCAD 25
Solved! Go to Solution.
2024-01-03 07:16 AM
Used below code
for (const IO::Location& location : textureFileNewLocationList) {
IO::Location* nonConstLocation = new IO::Location(location.ToDisplayText());
API_LibPart libPart = {};
BNZeroMemory (&libPart, sizeof (API_LibPart));
libPart.typeID = APILib_PictID;
libPart.location = nonConstLocation;
libParts.Push(libPart);
}
2023-12-06 10:37 AM
Update
I used below code, which loads the Lib Parts of mine but deletes all other default libraries provided by ArchiCAD
API_LibraryInfo libInfo;
IO::Location outputLoc (GetSpecialFolderLocation (API_ApplicationFolderID), IO::Name ("/Users/roni/Library/Application Support/GRAPHISOFT/AutoSave-25-2"));
libInfo.location = outputLoc;
GS::Array<API_LibraryInfo> lip = {libInfo};
err = ACAPI_Automate (APIDo_LoadLibrariesID, &lip);
if (err != NoError) {
ACAPI_WriteReport ("Error in APIDo_LoadLibrariesID", true);
}
2024-01-03 07:16 AM
Used below code
for (const IO::Location& location : textureFileNewLocationList) {
IO::Location* nonConstLocation = new IO::Location(location.ToDisplayText());
API_LibPart libPart = {};
BNZeroMemory (&libPart, sizeof (API_LibPart));
libPart.typeID = APILib_PictID;
libPart.location = nonConstLocation;
libParts.Push(libPart);
}