GDL
About building parametric objects with GDL.

Multiple label styles with dynamically changing parameters + fill rendering priority

Chicken
Participant

Hello,
I am new to GDL programming and I have not been able to solve these two problems. Could you please help me?


1. I would like to create a label that will have multiple preset styles. If the styles are selected, I want to dynamically override the parameters so that they also change in the settings. For example, Style 1 will have a green font color. When choosing a style, the color changes in the settings, but when I want to, the color can still be changed to something else in the settings.

label_2.png

This is one example parameter I would like to change dynamically based on the style. (red changes to green)

 

+ bonus question 🙂 how would you create these style options? using a subroutine or something else?

 

 

2. I haven't figured out how to force the fill (POLY2_B, not transparent, just lighter color) to be in front of the line. For some reason the text is already in front of everything, but how can I control the priority of the other elements? Is there a way?

label_1.png

 

Thanks for the suggestions

 

4 REPLIES 4
Jarrod Phillips
Enthusiast

Hi @Chicken, welcome to the world of GDL scripting.


In response to the second part of your first question, you can use the ‘values’ command to create options (there are more complex ways to do this however this should suffice). You will firstly need to create a new string parameter and then type the following in the parameter script:

 

values “parameterName”, “Option 1”, “Option 2”

 

Your parameter should now have 2 options to choose from. Then you can use if/endif statements to do something if option 1 is selected or do something else if option 2 is selected. For example:

 

if parameterName = “Option 1” then

 

    do something

 

endif

 

To answer your second question, you can use the ‘drawindex’ command to control the display order of 2d elements.

 

Cheers,

 

Jarrod

BIM Manager | Graduate of Architecture
Fulton Trotter Architects - Sydney, Australia
Archicad 15 - 27

Yes, I use the parameters to select the style and then call the subroutine according to the IF script. I should add that for the text color example I am trying to use the archicad parameter AC_TextPen_1.

 

Not sure if i'm using DRAWINDEX correctly, anyway I couldn't get it to work. LINE2 is before this script, so DRAWINDEX shouldn't affect it, right?

DRAWINDEX 50

	PEN			FramePen
	LINE_TYPE 	FrameType
	FILL 		FrameFill
	
	
	POLY2_B		2, _FrameFill,
				AC_LabelTextBgrPen, -1,
				Label_X, Label_Y, 900,
				_LabelFrameH, 360, 4001

 

Hi @Chicken,

 

I believe you will need to put "drawindex 40" infront of the line2 script segment.

 

Cheers,

 

Jarrod

BIM Manager | Graduate of Architecture
Fulton Trotter Architects - Sydney, Australia
Archicad 15 - 27
Yves
Advocate

Hi,
Like this

 

DRAWINDEX 30

	PEN			FramePen
	LINE_TYPE 	FrameType
	FILL 		FrameFill
	
DRAWINDEX 50	
	POLY2_B		2, _FrameFill,
				AC_LabelTextBgrPen, -1,
				Label_X, Label_Y, 900,
				_LabelFrameH, 360, 4001

 

Yves Houssier
Belgium
Archicad 19 -> 24
iMac - Mac Os 10,13