BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Save User Data in Library Part

Martin Walter
Enthusiast
What can I do to save binary user data with ~100KB in a Library Part?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Ralph Wessel
Mentor
Is the library part a door/window or an ordinary object?

If it's a door/window, the wall contains links to the embedded objects in its memo structure. You can obtain this with ACAPI_Element_GetMemo.

If it's an ordinary object, you will need to establish a link between the wall and object using ACAPI_Element_Link. You can later retrieve linked objects from the wall using ACAPI_Element_GetLinks.
Ralph Wessel BArch

View solution in original post

10 REPLIES 10
Ralph Wessel
Mentor
Is the data for use only by the add-on? Or does the library part need to share it?

If the former, use ACAPI_Element_SetUserData.

Otherwise (if the object needs to 'see' the data) you probably need to write the data to object parameters.
Ralph Wessel BArch
Martin Walter
Enthusiast
I'm creating a library part with some user data in the parameter section and putting it as element into a wall.

Later the user selects an element and the addon should get the library part from it and read the user data from the parameter section.

The first part seems to be working using ACAPI_LibPart_GetSect_ParamDef.

But how do I get the library part from a selected element?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Solution
Ralph Wessel
Mentor
Is the library part a door/window or an ordinary object?

If it's a door/window, the wall contains links to the embedded objects in its memo structure. You can obtain this with ACAPI_Element_GetMemo.

If it's an ordinary object, you will need to establish a link between the wall and object using ACAPI_Element_Link. You can later retrieve linked objects from the wall using ACAPI_Element_GetLinks.
Ralph Wessel BArch
Martin Walter
Enthusiast
It's a window or door. So what memo mask should I use for ACAPI_Element_GetMemo?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Ralph Wessel
Mentor
APIMemoMask_WallWindows for windows
APIMemoMask_WallDoors for doors
Ralph Wessel BArch
Martin Walter
Enthusiast
When the element was created I filled the memo with ACAPI_Element_GetDefaults(&element, &memo);

But calling ACAPI_Element_GetMemo now, the wallWindows pointer in API_ElementMemo is empty.
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Ralph Wessel
Mentor
Are there any windows placed in the wall?
Ralph Wessel BArch
Martin Walter
Enthusiast
Yes, I use a selected window, that is placed in the wall and would like to get the corresponding library part and then the user data.
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Martin Walter
Enthusiast
In the API file APIdefs_Elements.h
where the API_ElementMemo structure is defined there is the line:

API_Guid *wallWindows; // output only (obsolete, use ACAPI_Element_GetConnectedElements instead)

so maybe this part should not be used any more?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Learn and get certified!