2024-02-26 10:08 AM - last edited on 2024-09-26 01:14 PM by Doreena Deng
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.
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?
Thanks for the suggestions
2024-02-26 10:18 AM - edited 2024-02-26 10:33 AM
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
2024-02-26 10:46 AM
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
2024-02-26 12:02 PM
Hi @Chicken,
I believe you will need to put "drawindex 40" infront of the line2 script segment.
Cheers,
Jarrod
2024-02-26 12:10 PM
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