Modeling
About Archicad's design tools, element connections, modeling concepts, etc.

Custom character separator for requested parameter

jc4d
Expert

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?

 

jc4d_0-1644226380718.png

 

Cheers.

2 ACCEPTED SOLUTIONS
13 REPLIES 13
Barry Kelly
Moderator

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.

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

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:

jc4d_1-1644228963396.png

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.

 

 

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.

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

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.

Solution

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.

 

BarryKelly_0-1644288302429.png

 

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.

 

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

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:

jc4d_2-1644303621561.png

 

 

If I don't add the ^, the result in the 2D looks like this:

jc4d_0-1644303540054.png

 

After adding the ^, looks like this:

jc4d_1-1644303582038.png

 

 

About the door object, the parameter can be found here:

jc4d_0-1644302670179.png

 

 

Cheers.

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.

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

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.

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.

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

Start a new conversation!

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!