GDL
About building parametric objects with GDL.
SOLVED!

Possible to use element property value in a label?

Mats_Knutsson
Advisor

Hi,

I'd like to create a label with a 2D geometry, say a circle that changes color according to the value (text content) of a certain property. Is this possible? Let's say I've created a property "LENNART" available for doors. The property is an option set with values A, B and C and the label should change colour depending on the property value... A=red, B=green etc.LENNART.png

 

/Mats

 

AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Palawat
Advocate

Yes, a GDL label can do that.

In general, you can request PROPERTIES_OF_PARENT and then populate them using UI_CUSTOM_POPUP_INFIELD, in the UI scrip, to a parameter (a string type). Then assign it to "LENNART" by using the "Parameters" tab/page on GDL editing window, or by using the UI.

in 2D script, you then request PROPERTY_VALUE_OF_PARENT and use the value like;

if value = "A" then

...set your backgroud fill/pen

endif

 

There might be more requests needed. This is just from the top of my head. Sorry if I missed anything. But the thing is, if a built-in Properties Label exists, then label can definitely get that data.

 

Archicad 26, Windows 10, Corei7 3.4 GHz, 16 GB Ram.
https://www.indigofigs.com
https://www.facebook.com/indigofigs

View solution in original post

11 REPLIES 11
runxel
Legend

In short: it does not work. A GO rule can't catch the label – since it does not have the property.

And the GDL label itself can not be stylyed either, since it can't read the property (it only gets a GUID as reference pointer).

It's mad. Probably GS themself has no clue what the endgame here is.

 

But the idea is brilliant, and I know someone who scripted a door for their office having this feature built in. Then the GO kicks in and styles the circle.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

We have set up a Graphic Override which searches for a Property assigned to Doors to determine if the door is Existing, New Leaf in Existing Opening, New Doorset in existing opening and New Door. The graphic override then changes the colours of the doors themselves to match a pre-defined Key so we generate a Door Key Plan.

Lee Hankins
ArchiCAD 4.5 - Archicad 27UKI Apple Silicon 27.1.1
macOS Sonoma (14.2)

It's not what I'm after. It's up to 6 different properties (= 6 colored blobs in a 2x3 matrix)..2023-01-19_15-32-12.png.

AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.

Not currently possible with our a python script.

You can use the id of the door to change both a label and the door object and property

poco2013
Mentor

Just to clarify for those interested in how a Python script works in Archicad and why it is so limited. it is possible, but I think you would agree that the configuration is more trouble than worth in this instance.

 

The problem, as said, is that labels are 2D elements and 2D elements can not contain properties. The work around is to simply create a object which is simply a circle with a fill. Then classify it and add the option property. You would need to add a second property tying it to a door ID and perhaps a third property identifying the object as a door identifier -- or maybe just use the classification.

 

The Python script would read the door criteria (whatever) and the associated symbol ID and then set the symbol option accordingly. A graphic override (one for each option)  would then set the colors according to the option value.

 

IOW -- just set the door id accordingly -- or modify the door gsm to include a color identifier and good luck with that?.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

@poco2013 wrote:

The problem, as said, is that labels are 2D elements and 2D elements can not contain properties.


The label does not need to contain the property.

It reads the property from the object, which can be done.

The label can read and display the property with no problems.

 

The question is can the label read the value of the property and act on it.

If property value = A then change the label colour to red.

If property value = B then change the label colour to blue.

 

Without setting it all up, off the top of my head I can't remember if the label can utilise the value of a property or as runxel said it can only read and display the property.

 

No time to investigate right at the moment.

But if I get a chance later I will have a look.

 

Barry.

 

 

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

@Barry Kelly wrote:

The question is can the label read the value of the property and act on it.


To my knowledge, OOTB Archicad labels do not feature any custom actions, other than programed. I presume you are suggesting writing a custom gsm label. Than I would agree that it would be possible since associated labels contain a parent GUID field or you could use the parent ID field if it was unique. This would not be possible with a Python script since it can not, at present, address the label type. 

 

Of course, this could be easily done with a C++ AddOn but i don't think anyone wants to go there.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Solution
Palawat
Advocate

Yes, a GDL label can do that.

In general, you can request PROPERTIES_OF_PARENT and then populate them using UI_CUSTOM_POPUP_INFIELD, in the UI scrip, to a parameter (a string type). Then assign it to "LENNART" by using the "Parameters" tab/page on GDL editing window, or by using the UI.

in 2D script, you then request PROPERTY_VALUE_OF_PARENT and use the value like;

if value = "A" then

...set your backgroud fill/pen

endif

 

There might be more requests needed. This is just from the top of my head. Sorry if I missed anything. But the thing is, if a built-in Properties Label exists, then label can definitely get that data.

 

Archicad 26, Windows 10, Corei7 3.4 GHz, 16 GB Ram.
https://www.indigofigs.com
https://www.facebook.com/indigofigs

This would make a perfect tutorial case for custom gdl label scripting :). I don't know how to do this...

AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.