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.

Change label's text to an autotext

yahavsa
Contributor

Hi there
I'm trying to change a label's text to an autotext, which depends on it's parent type in this case. I got the key and value of the autotext that I need. Now I'm trying to insert the autotext into the label text, but haven't succeeded yet.
I'll really appreciated any solution.
Thanks!

4 REPLIES 4
poco2013
Mentor

From the API Documentation ----

 

"...an associative Label cannot be made independent, and an independent Label cannot be made associative."

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Hi Gerry
Thank you very much for the really fast response!
I'm not sure that I clearly understood that... in both cases, if I create an associative label or an independent one, I didn't succeed in placing an autotext in the text field instead of the default text that creates when I create a new label. I didn't try to make an existing associative Label independent, or make an existing independent Label associative.
Thanks again!

 

 

Windows 11, Visual Studio 2019, ArchiCAD 26

poco2013
Mentor

I understand that you are trying to change a autotext attribute to a different autotext attributive for the same  element? But you did not say of what type script are you using. If C++, you must use the proper autotext key format i.e with <> enclosure and format of <PROPERTY_ (GUID).

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Hello Gerry
That's right, I forgot to mention that I'm using C++, sorry about that.
I did try to use the proper autotext key format and I got an exception.
I'll go throw the process I did so maybe you can find something I did wrong:

- First of all, I created a default label element and change it's parent to a given window GUID (See attached TestLabelAutotext picture), Then:

1. First, I tried to use the relevant key given by the Hash table that I get when using the APIAny_GetPropertyAutoTextKeyTableID function.
It gives the format of PROPERTY_ (GUID) without the <> enclosure so I added it manually. When doing that, I get the exception (see picture Test1).

2. I tried to add the format of PROPERTY_ (GUID) manually, and I got the same exaption (See picture Test2)

3. I tried to change the format of PROPERTY_ (GUID) without using the <> enclosure. The label's text was changed, not to the autotext I need but to the format of PROPERTY_ (GUID) itself (See picture Test3)


TestLabelAutotext.jpgTest1.jpgtest2.jpgtest3.jpg
Learn and get certified!