2021-12-20 11:25 AM - last edited on 2024-09-09 11:23 AM by Doreena Deng
I am currently trying to create a zone label in which the values are updated programmatically via the API.
I've tried the following so far without any success:
1) Tried setting the parameter value of the label's display text using the API. While this worked for other GDL object types, it did not work for labels.
2)Tried ACAPI_Element_GetPropertyDefinitions to get the property definitions first, so that I can somehow set the value later. However, I get null value in property definitions for labels. It works fine for other objects like walls.
Is it possible to update text in labels programmatically ?
Thanks.
2021-12-20 11:48 AM
I don't have a solution for you.
But just for clarity.
Are you trying to update text settings such as font, colour, size, justification, etc.?
Or are you trying to adjust the values of what the text is actually displaying?
Apart from choosing what property or parameter you want to display, labels get the actual values from the associated element.
Barry.
2021-12-20 01:16 PM
Create label that read property of zone (or use standart) and change zone property via API.
Structural engineer, developer of free addon for sync GDL param and properties
2021-12-20 08:48 PM
Labels in the C++ API can more complicated. Zones, as of 25, can use either the "zone stamp" which is a label that uses a library object or a standard associated label. Do you just want to change text or a AutoText property. If a property, you must have the property key. Do want to change an exiting label or create and attach one, if so, how do you want to select and attach?? Sounds like, the better choice would be to just use the AutoText feature in 25?.
To set or modify existing labels, you may want to check out using the Python AddOn described below your post.
Else, check out the example functions in the Element_test example in the C++ Development Kit. An example of a associated label is given there.
2021-12-21 01:05 AM - edited 2021-12-21 01:06 AM
Hi Barry
Thank you very much for your response.
I am actually trying to do the latter.
I tried creating a label GDL that is supposed to get the properties from the associated element. However, it did not work for zones. The same script works without any problem for slabs.
Since, getting properties directly from the zone did not work, I am trying to create an empty label and then get the properties and display it in the label via the API. However, this does not seem to work for zones as well.
Eshanta
2021-12-21 01:16 AM
Hi kuvbur, poco2013,
Thank you for your reply.
I have a label GDL with blank fields. I tried getting it's properties from the associated zone using GDL script. However, I was not able to get the property values for cases when the element type is zone.
Hence, I thought an alternative might be to create a blank label GDL, define parameters inside it and then change the values of those parameters via API. If it is not a GDL of type Label, I can change it's parameters via the API without any problem. But for labels, although it does not return any errors, the parameter is not updated in the Label GDL.
In any case I will check out the ELement_test example from the API development kit.
Eshanta
2021-12-21 05:34 AM
You may not be interested, but I made a short video which demos the ease of doing what you described in Python. All we need is some increased cooperation from Graphisoft to make several issues like this viable.
I would be interested in any comments?
AutoText Zone Label with Multiple Variables
2021-12-23 03:20 AM
Hi Gerry,
Thank you very much for the demo.
The solution seems interesting. I have to use the API in C++ and the Archicad version needs to be 24.
However, the potential with python does look promising.
Eshanta
2021-12-23 03:27 AM
Just in case it might be useful to someone, I achieved this by getting the element memo using ACAPI_Element_GetMemo and then I extracted the value of the parameters from the element memo.
I changed the parameter values in the program and then used ACAPI_Element_Change to write back the changed parameters to the element.
By doing this, I was able to change the parameter values of the label.
2022-01-04 03:49 PM
Heelo, did you manage to retrieve all of the zone stamp parameters with ACAPI_Element_GetMemo? I'm trying something similar on AC25, but it is only returning the first one for whatever reason.