We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-10-04 05:36 PM - last edited on 2024-09-24 10:28 AM by Doreena Deng
I am creating an object using GDL and I would like to know if there is a way for me to insert a label in 2D with text linked to the material used in the object.
For example, if I insert the concrete material into the object, the label automatically updates and shows the "concrete" 2D text.
Is there a way to do this via GDL?
Thank you in advance
2023-10-04 07:49 PM
@rodlee94 , yes it's possible. You would need to request the name of the material and use it with the text2 command.
So if you select your concrete material from a parameter named "materialParam" for example it would go like this :
n = request("Name_of_material", materialParam, name)
x = 0
y = 0
if n > 0 then
text2 x, y, name
endif
The request retrieves the name of the material in a variable called "name". If it can't retrieve anything then "n" is equal to 0 hence the if condition wrapping the text2. Then you can use the text2 command to display it in plan view with coordinates that you can set up the way you want.
2023-10-05 07:34 AM
Can I ask a question about "Name of material", the manual said it does not compatible with ac
20 above??
2023-10-05 07:58 AM
That is if you try to request the name of the material in the parameter or master scripts.
But if you request it in the 2D or 3D scripts, it should be fine.
Barry.
2023-10-05 08:24 AM
I see, thank you!😀