We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2019-11-14 11:28 PM - last edited on 2022-09-29 10:01 AM by Daniel Kassai
/// @param path the path on the filesystem to the GDL to import /// @param library_folder path within the embedded library to import the item to GS::Int32 Archlog_import::add_to_embedded_library(const IO::Location &path, const IO::RelativeLocation &library_folder) { if (path.IsEmpty()) { return -2; } GS::Array<API_LibraryInfo> activeLibs; GSErrCode err; GS::Int32 embeddedLibraryIndex = -1; err = ACAPI_Environment(APIEnv_GetLibrariesID, &activeLibs, &embeddedLibraryIndex); if (err != NoError || embeddedLibraryIndex == -1) { // no embedded library return -4; } IO::Location embedded_folder = activeLibs[embeddedLibraryIndex].location; IO::RelativeLocation folders(IO::Name("Arch-LOG")); folders.Append(library_folder); for (USize i = 0; i < folders.GetLength(); ++i) { IO::Name folder; folders.GetName(i, &folder); embedded_folder.AppendToLocal(folder); err = ACAPI_Environment(APIEnv_CreateFolderInLibraryID, &embedded_folder); if (err != NoError) { return -5; } } GS::Array<IO::Location> fileToCopy; fileToCopy.Push(path); bool overwrite=true; err = ACAPI_Environment(APIEnv_CopyFilesIntoLibraryID, &embedded_folder, &fileToCopy, &overwrite); if (err != NoError) { return -6; } IO::Location embedded_file(embedded_folder); IO::Name name; path.GetLastLocalName(&name); embedded_file.AppendToLocal(name); API_LibPart libPart; BNZeroMemory(&libPart, sizeof(API_LibPart)); libPart.typeID = APILib_ObjectID; libPart.location = &embedded_file; err = ACAPI_LibPart_Register(&libPart); return err == NoError ? 0 : -7; }Is there some additional step we need to take to get the script to execute? Note that setting the part typeID to macro doesn't help.
2019-11-16 02:00 PM
2019-11-18 03:36 AM
2019-11-18 04:44 AM
2019-11-18 08:35 AM
2019-11-20 01:55 AM
2019-12-02 01:47 PM