<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create library (LibPart) based on an existing one in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287478#M4847</link>
    <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;
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.&lt;/BLOCKQUOTE&gt;

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).&lt;BR /&gt;
This tool converts the library parts to and from XML format; it's way much easier than doing it from an add-on.&lt;BR /&gt;
We ourselves keep our own libraries in XML form.&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
    <pubDate>Wed, 14 Oct 2015 11:57:04 GMT</pubDate>
    <dc:creator>Akos Somorjai</dc:creator>
    <dc:date>2015-10-14T11:57:04Z</dc:date>
    <item>
      <title>Create library (LibPart) based on an existing one</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287475#M4844</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;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, &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSection()&lt;/FONT&gt; will return &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt; for pictures, macros, etc.&lt;BR /&gt;&lt;BR /&gt;I also followed the example given at the documentation of &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSectionList()&lt;/FONT&gt;, modify it so that I will create a "destination" library.&lt;BR /&gt;&lt;BR /&gt;When I called &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSection()&lt;/FONT&gt;, I got &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt; and &lt;FONT color="#808080"&gt;APIERR_NOLIBSECT&lt;/FONT&gt; on some of the sections. This means that the list that I got form &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSectionList()&lt;/FONT&gt; have a "non-existing" section; or (as I interpret it) the section exists but the &lt;FONT color="#808080"&gt;sectionHdl&lt;/FONT&gt; and &lt;FONT color="#808080"&gt;sectionStr&lt;/FONT&gt; are not valid.&lt;BR /&gt;&lt;BR /&gt;So how am I to copy [, create, and/or modify] these sections:&lt;BR /&gt;&lt;BR /&gt;Sections with &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt;:&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectAncestors&lt;/FONT&gt;&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectCalledMacros&lt;/FONT&gt;&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectInfoGIF&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Sections with &lt;FONT color="#808080"&gt;APIERR_NOLIBSECT&lt;/FONT&gt;:&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectMigrTable&lt;/FONT&gt;&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectCust_Keywords&lt;/FONT&gt; (&lt;FONT color="#808080"&gt;'KWRD'&lt;/FONT&gt;, this section is part of the section list but not part of the definitions, &lt;FONT color="#808080"&gt;#define API_Sect...&lt;/FONT&gt;)&lt;BR /&gt;* &lt;FONT color="#808080"&gt;API_SectCopyright&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I am also unable to find how to set/get values for the LibPart:&lt;BR /&gt;* Details &amp;gt; Author (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;see EDIT (2015 Aug 24))&lt;BR /&gt;* Details &amp;gt; Compatibility Options... (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;see EDIT (2015 Aug 19))&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;EDIT (2015 Aug 19)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I am now able to copy "Details &amp;gt; Compatibility Options..." via:
&lt;PRE&gt;ACAPI_LibPart_GetDetails(oldLibPartIdx, &amp;amp;detl);
...
ACAPI_LibPart_SetDetails_ParamDef(&amp;amp;newLibPart, paramsHdl, &amp;amp;detl);&lt;/PRE&gt;
&lt;STRONG&gt;EDIT (2015 Aug 24)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Based on the binary data of the library, the "Details &amp;gt; 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 &lt;FONT color="#808080"&gt;GSHandle&lt;/FONT&gt; and call save section API, but still error.&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Jul 2023 13:44:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287475#M4844</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2023-07-13T13:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create library (LibPart) based on an existing one</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287476#M4845</link>
      <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;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, &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSection()&lt;/FONT&gt; will return &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt; for pictures, macros, etc.&lt;BR /&gt;
&lt;BR /&gt;
I also followed the example given at the documentation of &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSectionList()&lt;/FONT&gt;, modify it so that I will create a "destination" library.&lt;BR /&gt;
&lt;BR /&gt;
When I called &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSection()&lt;/FONT&gt;, I got &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt; and &lt;FONT color="#808080"&gt;APIERR_NOLIBSECT&lt;/FONT&gt; on some of the sections. This means that the list that I got form &lt;FONT color="#808080"&gt;ACAPI_LibPart_GetSectionList()&lt;/FONT&gt; have a "non-existing" section; or (as I interpret it) the section exists but the &lt;FONT color="#808080"&gt;sectionHdl&lt;/FONT&gt; and &lt;FONT color="#808080"&gt;sectionStr&lt;/FONT&gt; are not valid.&lt;BR /&gt;
&lt;BR /&gt;
So how am I to copy [, create, and/or modify] these sections:&lt;BR /&gt;
&lt;BR /&gt;
Sections with &lt;FONT color="#808080"&gt;APIERR_BADPARS&lt;/FONT&gt;:&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectAncestors&lt;/FONT&gt;&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectCalledMacros&lt;/FONT&gt;&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectInfoGIF&lt;/FONT&gt;&lt;BR /&gt;
&lt;BR /&gt;
Sections with &lt;FONT color="#808080"&gt;APIERR_NOLIBSECT&lt;/FONT&gt;:&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectMigrTable&lt;/FONT&gt;&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectCust_Keywords&lt;/FONT&gt; (&lt;FONT color="#808080"&gt;'KWRD'&lt;/FONT&gt;, this section is part of the section list but not part of the definitions, &lt;FONT color="#808080"&gt;#define API_Sect...&lt;/FONT&gt;)&lt;BR /&gt;
* &lt;FONT color="#808080"&gt;API_SectCopyright&lt;/FONT&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;EDIT&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
I am also unable to find how to set/get values for the LibPart:&lt;BR /&gt;
* Details &amp;gt; Author (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;see EDIT (2015 Aug 24)&lt;E&gt;&lt;/E&gt;)&lt;BR /&gt;
* Details &amp;gt; Compatibility Options... (&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;see EDIT (2015 Aug 19)&lt;E&gt;&lt;/E&gt;)&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;EDIT (2015 Aug 19)&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
I am now able to copy "Details &amp;gt; Compatibility Options..." via:
&lt;PRE&gt;ACAPI_LibPart_GetDetails(oldLibPartIdx, &amp;amp;detl);
...
ACAPI_LibPart_SetDetails_ParamDef(&amp;amp;newLibPart, paramsHdl, &amp;amp;detl);&lt;/PRE&gt;

&lt;B&gt;EDIT (2015 Aug 24)&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
Based on the binary data of the library, the "Details &amp;gt; 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 &lt;FONT color="#808080"&gt;GSHandle&lt;/FONT&gt; and call save section API, but still error.&lt;/BLOCKQUOTE&gt;

Hi,&lt;BR /&gt;
&lt;BR /&gt;
Why would you like to copy an existing library part? The copyright section is there for a reason &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
      <pubDate>Fri, 02 Oct 2015 11:23:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287476#M4845</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2015-10-02T11:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create library (LibPart) based on an existing one</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287477#M4846</link>
      <description>&lt;BLOCKQUOTE&gt;Akos wrote:&lt;BR /&gt;Why would you like to copy an existing library part? The copyright section is there for a reason &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/BLOCKQUOTE&gt;

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 &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;copy&lt;E&gt;&lt;/E&gt; is &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;us&lt;E&gt;&lt;/E&gt;.&lt;BR /&gt;
&lt;BR /&gt;
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.</description>
      <pubDate>Tue, 13 Oct 2015 08:33:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287477#M4846</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2015-10-13T08:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create library (LibPart) based on an existing one</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287478#M4847</link>
      <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;
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.&lt;/BLOCKQUOTE&gt;

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).&lt;BR /&gt;
This tool converts the library parts to and from XML format; it's way much easier than doing it from an add-on.&lt;BR /&gt;
We ourselves keep our own libraries in XML form.&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
      <pubDate>Wed, 14 Oct 2015 11:57:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-library-LibPart-based-on-an-existing-one/m-p/287478#M4847</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2015-10-14T11:57:04Z</dc:date>
    </item>
  </channel>
</rss>

