<?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 How to use the 'LibPart' to create Axis Net? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152384#M6535</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;I have found the 'LibPart' of the element of Axis Net. But when I create, it error.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;BNZeroMemory (&amp;amp;element, sizeof (API_Element));
BNZeroMemory(&amp;amp;element, sizeof(API_ElementMemo));
element.header.typeID = API_ObjectID;
ACAPI_Element_GetDefaults(&amp;amp;element, &amp;amp;memo);

for(int j = 0; j &amp;lt; addParNum; j++)
{
     API_AddParType &amp;amp;addPar = (*addPars);
     if(CHEqualCStrings(addPar.name, "AC_MarkerText_1"))
    {
         GS::ucscpy(addPar.value.uStr, L("A"));
    }
}

element.object.pos.x = c.x;
element.object.pos.y = c.y;
element.object.libInd = libPart.index;
element.object.angle = 0;

memo.params = addPars;

err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
&lt;/PRE&gt;
it returns the error "APIERR_BADPARS".&lt;BR /&gt;What's wrong?&lt;/DIV&gt;</description>
    <pubDate>Mon, 09 Sep 2024 08:51:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-09T08:51:38Z</dc:date>
    <item>
      <title>How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152384#M6535</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I have found the 'LibPart' of the element of Axis Net. But when I create, it error.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;BNZeroMemory (&amp;amp;element, sizeof (API_Element));
BNZeroMemory(&amp;amp;element, sizeof(API_ElementMemo));
element.header.typeID = API_ObjectID;
ACAPI_Element_GetDefaults(&amp;amp;element, &amp;amp;memo);

for(int j = 0; j &amp;lt; addParNum; j++)
{
     API_AddParType &amp;amp;addPar = (*addPars);
     if(CHEqualCStrings(addPar.name, "AC_MarkerText_1"))
    {
         GS::ucscpy(addPar.value.uStr, L("A"));
    }
}

element.object.pos.x = c.x;
element.object.pos.y = c.y;
element.object.libInd = libPart.index;
element.object.angle = 0;

memo.params = addPars;

err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
&lt;/PRE&gt;
it returns the error "APIERR_BADPARS".&lt;BR /&gt;What's wrong?&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Sep 2024 08:51:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152384#M6535</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-09T08:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152385#M6536</link>
      <description>&lt;BLOCKQUOTE&gt;wcyoot wrote:&lt;BR /&gt;I have found the 'LibPart' of the element of Axis Net. But when I create, it error.
&lt;/BLOCKQUOTE&gt;
You haven't shown all your source code, so the problem may be outside of this, e.g how did you obtain &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;addPars&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;libPart.index&lt;E&gt;&lt;/E&gt;? Have you opened an 'Undo' session with &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_OpenUndoableSession&lt;E&gt;&lt;/E&gt;?&lt;BR /&gt;
You also have an obvious bug here:&lt;PRE&gt;BNZeroMemory(&amp;amp;element, sizeof(API_ElementMemo)); &lt;/PRE&gt;
That should be:&lt;PRE&gt;BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo)); &lt;/PRE&gt;
That bug alone may be causing the problem (because the memo fields are not initialised to zero). I recommend starting with code from the examples bundled with the API. You could look at the code for &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;Do_CreateWindow&lt;E&gt;&lt;/E&gt; in the &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;Element_Test&lt;E&gt;&lt;/E&gt; project, which places a window object in a specified wall.</description>
      <pubDate>Wed, 14 Jan 2009 13:05:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152385#M6536</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-01-14T13:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152386#M6537</link>
      <description>I am sure I have got the &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;libPart&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;addPars&lt;E&gt;&lt;/E&gt;, because I have debug it step and step.I also correct that bug. But has no effect.</description>
      <pubDate>Fri, 16 Jan 2009 07:21:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152386#M6537</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-01-16T07:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152387#M6538</link>
      <description>&lt;BLOCKQUOTE&gt;wcyoot wrote:&lt;BR /&gt;I am sure I have got the &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;libPart&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;addPars&lt;E&gt;&lt;/E&gt;, because I have debug it step and step.I also correct that bug. But has no effect.&lt;/BLOCKQUOTE&gt;
OK. Can you confirm you are using &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_OpenUndoableSession&lt;E&gt;&lt;/E&gt; prior to the code shown?&lt;BR /&gt;
&lt;BR /&gt;
Also, check the attributes of the newly created object, particularly the layer. &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_Element_GetDefaults&lt;E&gt;&lt;/E&gt; obtains the current tool settings, but they are not necessarily valid, e.g. the selected layer may be locked, hidden, or even missing. The same is true for other attributes, e.g. materials. Check the storey settings too.&lt;BR /&gt;
&lt;BR /&gt;
Also, what type of library part are you trying to place, i.e. what is "Axis Net"? Is it a simple object, or does it have a 'special' purpose, e.g. a door, window, or label, which might require different data?&lt;BR /&gt;
&lt;BR /&gt;
I also recommend simplifying your code as much as possible when you hit a snag like this. Take out anything inessential, e.g. the code that modifies the "AC_MarkerText_1" parameter, so you reduce the problem to the smallest possible subset of commands. Once the essential code works you can continue adding additional features</description>
      <pubDate>Fri, 16 Jan 2009 14:55:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152387#M6538</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2009-01-16T14:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152388#M6539</link>
      <description>I'm sure I have used &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_OpenUndoableSession&lt;E&gt;&lt;/E&gt;,  I have used the same way to create another &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;LibPart&lt;E&gt;&lt;/E&gt;, but I cannot create this by the same way.</description>
      <pubDate>Tue, 20 Jan 2009 07:29:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152388#M6539</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-01-20T07:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the 'LibPart' to create Axis Net?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152389#M6540</link>
      <description>&lt;BLOCKQUOTE&gt;wcyoot wrote:&lt;BR /&gt;I'm sure I have used &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_OpenUndoableSession&lt;E&gt;&lt;/E&gt;,  I have used the same way to create another &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;LibPart&lt;E&gt;&lt;/E&gt;, but I cannot create this by the same way.&lt;/BLOCKQUOTE&gt;

Where are the addPar and the libPart.index coming from? Is it possible that you really have a bad set parameters?&lt;BR /&gt;
&lt;BR /&gt;
best,&lt;BR /&gt;
&lt;BR /&gt;
Akos</description>
      <pubDate>Thu, 05 Feb 2009 15:54:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-use-the-LibPart-to-create-Axis-Net/m-p/152389#M6540</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2009-02-05T15:54:16Z</dc:date>
    </item>
  </channel>
</rss>

