Creating a new Element for a Library Object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-01-21
03:03 PM
- last edited on
2022-10-04
04:42 PM
by
Daniel Kassai
With your help I imported this library object from an .lcf file which has classification Building Element Proxy:
I have to create an element for it and I want to ask the following:
1. Do I have to use ACAPI_Element_Create or some API_LibPart function?
2. In the first case, is this the correct ID - element.header.typeID = API_ObjectID?
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?
I could not find anything relevant in the example and in the other topics in the forum.
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-01-22 10:20 AM
API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.typeID = API_ObjectID; API_ElementMemo elementMemo; BNZeroMemory (&elementMemo, sizeof (API_ElementMemo)); ACAPI_Element_GetDefaults (&element, &elementMemo); element.object.libInd = libIndex; element.object.pos.x = 3; element.object.pos.y = 0; element.object.level = 0; ACAPI_Element_Create (&element, &elementMemo); ACAPI_DisposeElemMemoHdls (&elementMemo);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-01-21 10:14 PM
n.mihaylov wrote:In reply to your questions:
I have to create an element for it and I want to ask the following:
1. Do I have to use ACAPI_Element_Create or some API_LibPart function?
2. In the first case, is this the correct ID - element.header.typeID = API_ObjectID?
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?
1) Yes, new elements can be created with
2) Yes,
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.
I recommend looking at some of the API example projects, where you will find code for creating object elements etc.
Central Innovation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-01-22 10:20 AM
API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.typeID = API_ObjectID; API_ElementMemo elementMemo; BNZeroMemory (&elementMemo, sizeof (API_ElementMemo)); ACAPI_Element_GetDefaults (&element, &elementMemo); element.object.libInd = libIndex; element.object.pos.x = 3; element.object.pos.y = 0; element.object.level = 0; ACAPI_Element_Create (&element, &elementMemo); ACAPI_DisposeElemMemoHdls (&elementMemo);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-01-22 12:52 PM
GS::ucscpy (libPart.docu_UName, L("Object Name")); ACAPI_LibPart_Search (&libPart, false);Thank you both!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-05 02:59 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-05 03:24 PM
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.
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.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-06 08:15 AM
I found how to get the element:
API_LibPart libPart; BNZeroMemory (&libPart, sizeof (API_LibPart)); libPart.index = element.object.libInd; ACAPI_LibPart_Get (&libPart);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-06 10:00 AM
n.mihaylov wrote:It could become confusing if you use the wrong terminology. That code you quoted gives you the definition of a
I found how to get the element:API_LibPart libPart; BNZeroMemory (&libPart, sizeof (API_LibPart)); libPart.index = element.object.libInd; ACAPI_LibPart_Get (&libPart);
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-06 02:37 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-06 02:44 PM
n.mihaylov wrote: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).
Yes, I need to get details for my element and so I need the details for its Library Part.
Central Innovation