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

Is it possible with an API to connect a new element to an existing label?

LeeJaeYoung
Virtuoso

ACAPI_ELEMENT_MASK_CLEAR(mask);
ACAPI_ELEMENT_MASK_SET(mask, API_LabelType, parent);


element.label.parent = guid;

err = ACAPI_Element_Change(&element, &mask, &memo, 0, true);

This code is wrong. 

The label is not associated with a new element.

AC27 on window 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
poco2013
Mentor

I believe that once created and placed, the status of a label can not be changed. This is because associated labels acquire the guid of the element they are attached to. Maybe wrong on this one?

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

View solution in original post

3 REPLIES 3
Solution
poco2013
Mentor

I believe that once created and placed, the status of a label can not be changed. This is because associated labels acquire the guid of the element they are attached to. Maybe wrong on this one?

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
LeeJaeYoung
Virtuoso

This is the part I don't understand.
If it's because of the Guid, it's because you'll have to re-specify the Guid.
If I need to fetch information via Guid, but there is no command to get it back, then I can understand.
This article was translated from translate.google.com.

AC27 on window 11
LeeJaeYoung
Virtuoso

I know what you said is true.
thank you.
Have a nice day
API_LabelType
parent 
When creating new Labels,
set this to APINULLGuid to create an independent Label; or
set this to the GUID of the owner element (a labelable element) to create an associative Label.

When getting or changing a Label, this member will be filled with the GUID of the owner element,
or APINULLGuid, if the Label is independent.
It is not allowed to make an existing associative Label independent,
or make an existing independent Label associative.

AC27 on window 11