Archicad C++ API
About Archicad add-on development using the C++ API.

Prevent element from copy user data

Anonymous
Not applicable
I use function function ACAPI_​Element_​SetUserData to attach additional information. The problem is that this data is copied with element when i "Drag a Copy" and then I have to deal with unwanted behaviorur caused by that. Is there a way to prevent Archicad from copying this additional bytes?
6 REPLIES 6
Ralph Wessel
Mentor
kostek142 wrote:
I use function function ACAPI_​Element_​SetUserData to attach additional information. The problem is that this data is copied with element when i "Drag a Copy" and then I have to deal with unwanted behaviorur caused by that. Is there a way to prevent archicad from copying this additional bytes?
Take a look at the flags member of the API_ElementUserData struct you pass to ACAPI_​Element_​SetUserData – this controls what happens to user data in events like this.
Ralph Wessel BArch
Anonymous
Not applicable
Can you tell me what specific flag can prevent my data from being copied? I think I have tried all of them with no positive result.
Ralph Wessel
Mentor
kostek142 wrote:
Can you tell me what specific flag can prevent my data from being copied? I think I have tried all of them with no positive result.
I'd forgotten about that – the relevant flag APIUserDataFlag_Copy disappeared from AC18 onward. You may need to request notification of the creation of new elements so you clear/update the data attached to the element as required. Perhaps someone else might have another solution.
Ralph Wessel BArch
Akos Somorjai
Graphisoft
Graphisoft
Ralph wrote:
kostek142 wrote:
Can you tell me what specific flag can prevent my data from being copied? I think I have tried all of them with no positive result.
I'd forgotten about that – the relevant flag APIUserDataFlag_Copy disappeared from AC18 onward. You may need to request notification of the creation of new elements so you clear/update the data attached to the element as required. Perhaps someone else might have another solution.
If I remember well you have to leave the userData.flags empty, which means that the user data will not be copied to the new element. If you want to update the user data, then do as Ralph suggested.

Regards, Akos
Anonymous
Not applicable
Thanks for reply Akos.

Unfourtunately leaving flag empty also wasn't the solution. I found workaround, just wanted to notice the fact, maybe you can fix it in the next build of API or something

Regards
Akos Somorjai
Graphisoft
Graphisoft
kostek142 wrote:
Thanks for reply Akos.

Unfourtunately leaving flag empty also wasn't the solution. I found workaround, just wanted to notice the fact, maybe you can fix it in the next build of API or something

Regards
Thanks!

Akos