<?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: Creating a new Element for a Library Object in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277834#M3576</link>
    <description>In my case I needed the name of the Library Part and found only this way to get it.&lt;BR /&gt;
I thik it can't be overridden by the instance element.</description>
    <pubDate>Wed, 06 Feb 2019 13:48:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-02-06T13:48:29Z</dc:date>
    <item>
      <title>Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277824#M3566</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi guys,&lt;BR /&gt;&lt;BR /&gt;With your help I imported this library object from an .lcf file which has classification Building Element Proxy:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have to create an element for it and I want to ask the following:&lt;BR /&gt;&lt;BR /&gt;1. Do I have to use ACAPI_Element_Create or some API_​LibPart function?&lt;BR /&gt;&lt;BR /&gt;2. In the first case, is this the correct ID - element.header.typeID = API_ObjectID?&lt;BR /&gt;&lt;BR /&gt;3. Do I have to set in the memo the coordinates and sizes of all the "lines" which build this figure? If I already have them imported, can I retrieve them in some way?&lt;BR /&gt;&lt;BR /&gt;I could not find anything relevant in the example and in the other topics in the forum.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:42:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277824#M3566</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-04T14:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277825#M3567</link>
      <description>&lt;BLOCKQUOTE&gt;n.mihaylov wrote:&lt;BR /&gt;I have to create an element for it and I want to ask the following:&lt;BR /&gt;
1. Do I have to use ACAPI_Element_Create or some API_​LibPart function?&lt;BR /&gt;
2. In the first case, is this the correct ID - element.header.typeID = API_ObjectID?&lt;BR /&gt;
3. Do I have to set in the memo the coordinates and sizes of all the "lines" which build this figure? If I already have them imported, can I retrieve them in some way?&lt;/BLOCKQUOTE&gt;
In reply to your questions:&lt;BR /&gt;
1) Yes, new elements can be created 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_Element_Create&lt;E&gt;&lt;/E&gt;&lt;BR /&gt;
&lt;BR /&gt;
2) Yes, &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;API_ObjectID&lt;E&gt;&lt;/E&gt; is the correct type for a general-purpose object element.&lt;BR /&gt;
&lt;BR /&gt;
3) I doubt it. Objects usually render themselves, either through a script and parameter values or by embedded (fixed) geometry. You may have to set some parameter values or (most likely) at least the bounding object size.&lt;BR /&gt;
&lt;BR /&gt;
I recommend looking at some of the API example projects, where you will find code for creating object elements etc.</description>
      <pubDate>Mon, 21 Jan 2019 21:14:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277825#M3567</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-01-21T21:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277826#M3568</link>
      <description>In a nutshell:
&lt;PRE&gt;API_Element element;
BNZeroMemory (&amp;amp;element, sizeof (API_Element));
element.header.typeID = API_ObjectID;

API_ElementMemo elementMemo;
BNZeroMemory (&amp;amp;elementMemo, sizeof (API_ElementMemo));
ACAPI_Element_GetDefaults (&amp;amp;element, &amp;amp;elementMemo);

element.object.libInd = libIndex;
element.object.pos.x = 3;
element.object.pos.y = 0;
element.object.level = 0;

ACAPI_Element_Create (&amp;amp;element, &amp;amp;elementMemo);
ACAPI_DisposeElemMemoHdls (&amp;amp;elementMemo);&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jan 2019 09:20:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277826#M3568</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-01-22T09:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277827#M3569</link>
      <description>It works after I got the libIndex (libPart.index) this way:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;GS::ucscpy (libPart.docu_UName, L("Object Name"));
ACAPI_LibPart_Search (&amp;amp;libPart, false);
&lt;/PRE&gt;

Thank you both!</description>
      <pubDate>Tue, 22 Jan 2019 11:52:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277827#M3569</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-22T11:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277828#M3570</link>
      <description>One more question:&lt;BR /&gt;
What type of structure is this API_ObjectType element? It is none of these below and I cannot get the corresponding index of the element.wall.composite index, for example, in order to set the attribute.header.index and get the element with ACAPI_Attribute_Get  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;</description>
      <pubDate>Tue, 05 Feb 2019 13:59:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277828#M3570</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-05T13:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277829#M3571</link>
      <description>API_ObjectType is an element created from a library part. The element contains a list of parameter values typically referenced by the library part to render it in 2D and 3D.&lt;BR /&gt;
&lt;BR /&gt;
A composite is a multi-skinned construction attribute specifying its component materials (including thickness and fill). A composite is relevant to planar elements like walls, roofs and slabs. Composites can't be applied to objects because there's no obvious application to a body that might have any shape.&lt;BR /&gt;
&lt;BR /&gt;
That's why you find that only a limited number of elements have a composite attribute. Objects may have many other attributes, e.g. materials, fills and pens. Some are stored in API_ObjectType, but they're more commonly found in the object's parameter settings.</description>
      <pubDate>Tue, 05 Feb 2019 14:24:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277829#M3571</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-02-05T14:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277830#M3572</link>
      <description>Thanks, got it!&lt;BR /&gt;
I found how to get the element:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;API_LibPart libPart;
BNZeroMemory (&amp;amp;libPart, sizeof (API_LibPart));
libPart.index = element.object.libInd;
ACAPI_LibPart_Get (&amp;amp;libPart);
&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Feb 2019 07:15:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277830#M3572</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-06T07:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277831#M3573</link>
      <description>&lt;BLOCKQUOTE&gt;n.mihaylov wrote:&lt;BR /&gt;I found how to get the element:
&lt;PRE&gt;API_LibPart libPart;
BNZeroMemory (&amp;amp;libPart, sizeof (API_LibPart));
libPart.index = element.object.libInd;
ACAPI_LibPart_Get (&amp;amp;libPart);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
It could become confusing if you use the wrong terminology. That code you quoted gives you the definition of a &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;library part&lt;E&gt;&lt;/E&gt;, not an &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&lt;E&gt;&lt;/E&gt;. You only have an element when an instance of the library part is placed in the project.</description>
      <pubDate>Wed, 06 Feb 2019 09:00:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277831#M3573</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-02-06T09:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277832#M3574</link>
      <description>Yes, you are right! I need to get details for my element and so I need the details for its Library Part.&lt;BR /&gt;
I have an element which is an instance of the Library Part. First I take the guids of all elements of type API_ObjectID with ACAPI_Element_GetElemList, then I take each element with ACAPI_Element_Get using these guids and finally I get the Library Part for my element with ACAPI_LibPart_Get using element.object.libInd as libPart.index  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_wink.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 06 Feb 2019 13:37:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277832#M3574</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-06T13:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277833#M3575</link>
      <description>&lt;BLOCKQUOTE&gt;n.mihaylov wrote:&lt;BR /&gt;
Yes, I need to get details for my element and so I need the details for its Library Part.&lt;/BLOCKQUOTE&gt;
Ok, that makes sense as long as the details you are interested in are defined by the library part and can't be overridden by the instance element. For example, the parameter values should be extracted from the element, not the library part (unless you want the defaults).</description>
      <pubDate>Wed, 06 Feb 2019 13:44:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277833#M3575</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-02-06T13:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277834#M3576</link>
      <description>In my case I needed the name of the Library Part and found only this way to get it.&lt;BR /&gt;
I thik it can't be overridden by the instance element.</description>
      <pubDate>Wed, 06 Feb 2019 13:48:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277834#M3576</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-06T13:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277835#M3577</link>
      <description>Hello again,&lt;BR /&gt;
&lt;BR /&gt;
I came upon the following strange problem:&lt;BR /&gt;
When I import a new Library Object and then create an element of it and place it, some of the parameters are changed and the whole element is "broken". The object itself is imported with the correct parameters in the Library Manager - if I manually choose the object and place an instance, everything is OK, the parameters are correct. Only the element created by ACAPI_Element_Create in my addon has wrong parameters.&lt;BR /&gt;
What could be the problem?&lt;BR /&gt;
&lt;BR /&gt;
Parameters from ACAPI_Element_Create    -----------    Parameters of object in Object Manager&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:17:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277835#M3577</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-13T16:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277836#M3578</link>
      <description>&lt;BLOCKQUOTE&gt;n.mihaylov wrote:&lt;BR /&gt;
When I import a new Library Object and then create an element of it and place it, some of the parameters are changed and the whole element is "broken". The object itself is imported with the correct parameters in the Library Manager - if I manually choose the object and place an instance, everything is OK, the parameters are correct. Only the element created by ACAPI_Element_Create in my addon has wrong parameters.&lt;BR /&gt;
What could be the problem?&lt;/BLOCKQUOTE&gt;
I think you want to look at what default values the element is inheriting when you use &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_Create&lt;E&gt;&lt;/E&gt;. Remember, the library part is like a template or class and its parameter values are at best a default. But each instance you place as an element can have any (allowed) values in the parameters, i.e. its values are disassociated from the library part (template).&lt;BR /&gt;
&lt;BR /&gt;
I'm guessing your default parameter values are probably coming from the Door tool settings. If you want them to be the same as the originating library part, make sure the memo settings for the element instance are copied from the library part memo.</description>
      <pubDate>Thu, 14 Mar 2019 09:26:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277836#M3578</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-03-14T09:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277837#M3579</link>
      <description>Thank you, Ralph!&lt;BR /&gt;
&lt;BR /&gt;
Now I know what to do but with no success so far  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt; &lt;BR /&gt;
According to the example for ACAPI_​Element_​GetDefaults, I added a new line setting APIVarId_Object and also doubled the element.object.libInd setting but I keep on getting the default values of an object called Armchair 01 22 from the default library:&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 12:48:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277837#M3579</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-14T12:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277838#M3580</link>
      <description>&lt;BLOCKQUOTE&gt;n.mihaylov wrote:&lt;BR /&gt;
According to the example for ACAPI_​Element_​GetDefaults, I added a new line setting APIVarId_Object and also doubled the element.object.libInd setting but I keep on getting the default values of an object called Armchair 01 22 from the default library:&lt;/BLOCKQUOTE&gt;
I think ACAPI_​Element_​GetDefaults will simply extract all the settings from the specified tool settings dialog, including the memo with the parameter settings. The libInd you specify is ignored and overwritten with whatever object is currently selected in the settings dialog.&lt;BR /&gt;
&lt;BR /&gt;
I think you probably need to get the memo from original library part use that when you create your new element. Then the parameters will be set to the default values of your original library part.</description>
      <pubDate>Thu, 14 Mar 2019 13:39:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277838#M3580</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-03-14T13:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277839#M3581</link>
      <description>I did not find any way to get the memo of a library part. The only way I think is to use ACAPI_LibPart_GetParams and then change all the params of the element after I create it   &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 15:59:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277839#M3581</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-14T15:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277840#M3582</link>
      <description>Take a look at &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_LibPart_GetParams&lt;E&gt;&lt;/E&gt;. This gives you the same handle to the object parameters that use in the element memo structure.</description>
      <pubDate>Fri, 15 Mar 2019 08:15:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277840#M3582</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-03-15T08:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Element for a Library Object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277841#M3583</link>
      <description>Yes, this did the trick   &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;   I just found this in DG_Test example.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_LibPart_GetParams (libPart.index, &amp;amp;aParam, &amp;amp;bParam, &amp;amp;addParNum, &amp;amp;elementMemo.params);
element.object.libInd = libPart.index;
element.object.pos.x = 3;
element.object.pos.y = 0;
element.object.level = 0;
element.object.xRatio = aParam;
element.object.yRatio = bParam;
        
ACAPI_Element_Create (&amp;amp;element, &amp;amp;elementMemo);
ACAPI_DisposeElemMemoHdls (&amp;amp;elementMemo);
&lt;/PRE&gt;

Now the element has the correct parameters.&lt;BR /&gt;
&lt;BR /&gt;
Thank you!</description>
      <pubDate>Fri, 15 Mar 2019 09:11:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-a-new-Element-for-a-Library-Object/m-p/277841#M3583</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-15T09:11:07Z</dc:date>
    </item>
  </channel>
</rss>

