Create library (LibPart) based on an existing one

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-07-30
12:35 PM
- last edited on
‎2023-07-13
03:44 PM
by
Doreena Deng
‎2015-07-30
12:35 PM
I am trying to create a library from an existing one. What I did was just get all the information from the "source" library then copy (and modify) them. I am able to do this but limited to some section. Based on the documentation, ACAPI_LibPart_GetSection() will return APIERR_BADPARS for pictures, macros, etc.
I also followed the example given at the documentation of ACAPI_LibPart_GetSectionList(), modify it so that I will create a "destination" library.
When I called ACAPI_LibPart_GetSection(), I got APIERR_BADPARS and APIERR_NOLIBSECT on some of the sections. This means that the list that I got form ACAPI_LibPart_GetSectionList() have a "non-existing" section; or (as I interpret it) the section exists but the sectionHdl and sectionStr are not valid.
So how am I to copy [, create, and/or modify] these sections:
Sections with APIERR_BADPARS:
* API_SectAncestors
* API_SectCalledMacros
* API_SectInfoGIF
Sections with APIERR_NOLIBSECT:
* API_SectMigrTable
* API_SectCust_Keywords ('KWRD', this section is part of the section list but not part of the definitions, #define API_Sect...)
* API_SectCopyright
EDIT
I am also unable to find how to set/get values for the LibPart:
* Details > Author (see EDIT (2015 Aug 24))
* Details > Compatibility Options... (see EDIT (2015 Aug 19))
EDIT (2015 Aug 19)
I am now able to copy "Details > Compatibility Options..." via:
Based on the binary data of the library, the "Details > Author" is part of the copyright section. But since there is an error, this is not saved. I also tried saving this binary data as GSHandle and call save section API, but still error.
I also followed the example given at the documentation of ACAPI_LibPart_GetSectionList(), modify it so that I will create a "destination" library.
When I called ACAPI_LibPart_GetSection(), I got APIERR_BADPARS and APIERR_NOLIBSECT on some of the sections. This means that the list that I got form ACAPI_LibPart_GetSectionList() have a "non-existing" section; or (as I interpret it) the section exists but the sectionHdl and sectionStr are not valid.
So how am I to copy [, create, and/or modify] these sections:
Sections with APIERR_BADPARS:
* API_SectAncestors
* API_SectCalledMacros
* API_SectInfoGIF
Sections with APIERR_NOLIBSECT:
* API_SectMigrTable
* API_SectCust_Keywords ('KWRD', this section is part of the section list but not part of the definitions, #define API_Sect...)
* API_SectCopyright
EDIT
I am also unable to find how to set/get values for the LibPart:
* Details > Author (
* Details > Compatibility Options... (
EDIT (2015 Aug 19)
I am now able to copy "Details > Compatibility Options..." via:
ACAPI_LibPart_GetDetails(oldLibPartIdx, &detl); ... ACAPI_LibPart_SetDetails_ParamDef(&newLibPart, paramsHdl, &detl);EDIT (2015 Aug 24)
Based on the binary data of the library, the "Details > Author" is part of the copyright section. But since there is an error, this is not saved. I also tried saving this binary data as GSHandle and call save section API, but still error.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-10-02 01:23 PM
‎2015-10-02
01:23 PM
ReignBough wrote:Hi,
I am trying to create a library from an existing one. What I did was just get all the information from the "source" library then copy (and modify) them. I am able to do this but limited to some section. Based on the documentation, ACAPI_LibPart_GetSection() will return APIERR_BADPARS for pictures, macros, etc.
I also followed the example given at the documentation of ACAPI_LibPart_GetSectionList(), modify it so that I will create a "destination" library.
When I called ACAPI_LibPart_GetSection(), I got APIERR_BADPARS and APIERR_NOLIBSECT on some of the sections. This means that the list that I got form ACAPI_LibPart_GetSectionList() have a "non-existing" section; or (as I interpret it) the section exists but the sectionHdl and sectionStr are not valid.
So how am I to copy [, create, and/or modify] these sections:
Sections with APIERR_BADPARS:
* API_SectAncestors
* API_SectCalledMacros
* API_SectInfoGIF
Sections with APIERR_NOLIBSECT:
* API_SectMigrTable
* API_SectCust_Keywords ('KWRD', this section is part of the section list but not part of the definitions, #define API_Sect...)
* API_SectCopyright
EDIT
I am also unable to find how to set/get values for the LibPart:
* Details > Author (see EDIT (2015 Aug 24))
* Details > Compatibility Options... (see EDIT (2015 Aug 19))
EDIT (2015 Aug 19)
I am now able to copy "Details > Compatibility Options..." via:ACAPI_LibPart_GetDetails(oldLibPartIdx, &detl); ... ACAPI_LibPart_SetDetails_ParamDef(&newLibPart, paramsHdl, &detl);EDIT (2015 Aug 24)
Based on the binary data of the library, the "Details > Author" is part of the copyright section. But since there is an error, this is not saved. I also tried saving this binary data as GSHandle and call save section API, but still error.
Why would you like to copy an existing library part? The copyright section is there for a reason

Best, Akos

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-10-13 10:33 AM
‎2015-10-13
10:33 AM
Akos wrote:But you can modify them on the dialog and save it with the new copyright. So, I assume that these values can be copied and/or modified. Also, the "Author" of the libraries that I want to
Why would you like to copy an existing library part? The copyright section is there for a reason 🙂
I just want to make a copy of the libraries and modify the contents, like adding parameter. So instead of adding this parameter on multiple libraries one by one, I just need to do it through an add-on.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-10-14 01:57 PM
‎2015-10-14
01:57 PM
ReignBough wrote:If you don't have to do it on the fly, then you can use the LP_XMLConverter tool for that (part of the Library Developer Kit, accessible from the same place where you got the API DevKit from).
I just want to make a copy of the libraries and modify the contents, like adding parameter. So instead of adding this parameter on multiple libraries one by one, I just need to do it through an add-on.
This tool converts the library parts to and from XML format; it's way much easier than doing it from an add-on.
We ourselves keep our own libraries in XML form.
Best, Akos