We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-02-07 10:35 AM
Hello,
I have managed to make a request for the door leaves width via GDL on a label object.
As you can see on the screenshot bellow, the label shows the door leaves width separated by "/" and I would like to change it for "x".
Is there a way to change that character for something else?
Cheers.
Solved! Go to Solution.
2022-02-08 03:47 AM - last edited on 2022-02-13 07:28 PM by Laszlo Nagy
Let's try this.
Might not be the best solution but I think it will work.
You request the door leaf value from the parameter 'gs_list_doorleafwidths' and then assign that value to the parameter '_DoorLeavesWidth'.
You need to SPLIT that parameter to get the leaf sizes and the separator.
This will give you a number, text, number.
The numbers you have to convert back to a text string and then join them all back together to re-create the '_DoorLeavesWidth' parameter but now with your new separator.
So this is what you want...
n = SPLIT (_DoorLeavesWidth, "%n/%n", n_leaf1, s_sep, n_leaf2)
s_leaf_1 = STR (n_leaf1, 3, 0)
s_leaf_2 = STR (n_leaf2, 3, 0)
_DoorLeavesWidth = s_leaf_1 + " x " + s_leaf_2
If you place it in your script here, I think it will work.
I do have that asymmetrical door object, but I see no way of changing the separator in the door parameters itself.
So I think the above is the best bet.
Barry.
2022-02-08 10:37 AM - last edited on 2022-02-13 07:41 PM by Laszlo Nagy
I guess it is all related to the original question so we will leave it together.
First ...
I don't know if you need that array, or at least you need a new one because you are assigning 2 different values to the same array variable.
I am not sure what they are used for - it is hard not seeing the whole label.
Second you are getting the unit height and assigning it to the _heightValue variable.
This is a number (length) variable.
I think all you need to do is convert that number to a string so you can tack it onto the end of the string you want to use in your label.
Something like this?
s_heightvalue = STR(_heightvalue, 3, 0)
Then use this for the string output in your label ...
s_leaf_1 + " x " + s_leaf_2 + s_heightvalue
Barry.
2022-02-07 11:03 AM
Where does the "/" character come from?
Is it part of the door parameters - can you change it there?
Or is it part of the label object - i.e. it is added in the label itself?
Barry.
2022-02-07 11:17 AM - edited 2022-02-07 11:19 AM
It is comming automatically as far as I know, because if I add that same parameter to the door schedule it shows the same character. I think that is added by that specific parameter and not by the label, but not sure.
This is how it shows the parameter on the schedule:
If I try to override it by simply writting an "x" it goes back to "/", but I was thinking that maybe in GDL I could force the character override. I'm clueless.
Cheers.
2022-02-07 02:49 PM
OK, so the 'door leaf widths' parameter seems to be coming from the door object, so it has to be changed in there.
Is there anything in the door parameters that lets you control this?
What door is it and what version of Archicad and language as well?
I only have the AUS library, so may not have the door you have to check it out.
Different language versions have different door and window objects.
You could alter the default Graphisoft door object - but that is really not a good idea.
Or if you wrote the GDL label, you could use the SPLIT command on that 'door leaf widths' parameter to split it into a number (first leaf), string (/), number (second leaf).
Then piece the text back together number (first leaf), your_string (x), number (second leaf).
SPLIT should work but if it doesn't you could maybe use STRLEN, STRSTR & STRSUB to find the number of characters in the 'door leaf widths' parameter, the position of the '/" character and then get the substrings for just the leaf size parts and put them back together as text with the 'x" separator.
Barry.
2022-02-07 04:28 PM - edited 2022-02-07 04:55 PM
Thnaks, I'm using INT version, and the door object is the one that comes with AC 25, hinged Double Door Asymmetric.
For the label I started using the default one that comes built-in which is Door Window Stamp.
I was trying your suggestion of splitting the name, but honestly I'm scratching my head on how to proceed with it. The name splitting should happen in the 2D script tab (I think), and this is my code in it:
! ==============================================================================
"getStringDoorLeaves":
! ------------------------------------------------------------------------------
_sPrefixStrings[iContent] = sDescriptionDoorLeavesWidth
if iDoorLeavesWidth = VALUE_AUTOMATIC then
_DoorLeavesWidth = "" : _heightValue = 0
nnn = request ("ASSOCLP_PARVALUE", "gs_list_doorleafwidths", index_ww, type_ww, flags_ww, dim1_ww, dim2_ww, _DoorLeavesWidth)
if bDefaultElem then
_sContentStrings[iContent][1] = _stLocNoContent ! "<no content defined>"
else
_sContentStrings[iContent][1] = _DoorLeavesWidth
endif
else
_sContentStrings[iContent][] = sValueDoorLeavesWidth
endif
return
gs_list_doorleafwidths is from where I get the door leaves width measure.
Cheers.
2022-02-08 03:47 AM - last edited on 2022-02-13 07:28 PM by Laszlo Nagy
Let's try this.
Might not be the best solution but I think it will work.
You request the door leaf value from the parameter 'gs_list_doorleafwidths' and then assign that value to the parameter '_DoorLeavesWidth'.
You need to SPLIT that parameter to get the leaf sizes and the separator.
This will give you a number, text, number.
The numbers you have to convert back to a text string and then join them all back together to re-create the '_DoorLeavesWidth' parameter but now with your new separator.
So this is what you want...
n = SPLIT (_DoorLeavesWidth, "%n/%n", n_leaf1, s_sep, n_leaf2)
s_leaf_1 = STR (n_leaf1, 3, 0)
s_leaf_2 = STR (n_leaf2, 3, 0)
_DoorLeavesWidth = s_leaf_1 + " x " + s_leaf_2
If you place it in your script here, I think it will work.
I do have that asymmetrical door object, but I see no way of changing the separator in the door parameters itself.
So I think the above is the best bet.
Barry.
2022-02-08 07:44 AM - edited 2022-02-08 08:00 AM
Fantastic, thank you so much for your time and support 🙂
I did a minor adjustment since the second value wasn't returning a float value, I added ^ in the %n, so it looks like this now:
n = SPLIT (_DoorLeavesWidth, "%^n/%^n", n_leaf1, s_sep, n_leaf2)
And everything is up and running.
The bigger door leaf has this value:
If I don't add the ^, the result in the 2D looks like this:
After adding the ^, looks like this:
About the door object, the parameter can be found here:
Cheers.
2022-02-08 08:23 AM
I have no idea what the ^ character does (I know mathematically it is power of) - but glad you got it figured out.
Maybe it is different for you as you have a comma denoting 1000's in your numbers.
On my system I don't have anything denoting 1000's.
Barry.
2022-02-08 08:53 AM
I was checking the gdl reference guide (SPLIT_gdlcommand ) and this is what it says:
format:
any combination of constant strings, %s, %n and %^n -s.
Parts in the string must fit the constant strings, %s denotes any string value delimited by spaces or tabs, while %n or %^n denotes any numeric value. If the ‘^’ flag is present, current system settings for decimal separator and digit grouping characters are taken into consideration when matching the actual numerical value.
Cheers.
2022-02-08 09:01 AM
Thanks for that.
So the '^' flag takes in to account the decimal separator.
I still read an old physical GDL book I have sitting on my desk but it is so old it does not mention this '^' flag.
I really must start using the PDF manual instead.
Barry.