Design forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom character separator for requested parameter

jc4d
Advocate

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

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

View solution in original post

Solution

I guess it is all related to the original question so we will leave it together.

First ...

BarryKelly_0-1644311814828.png

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.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

View solution in original post

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Sure, no problem. 🙂

 

Not sure if I can ask in this topic or open a new one (you can let me know).

I would like to add after those two values the height of the door.

I tried making a new request and append it at the end of the new value,in theory should be like this: n_leaf1 "+"  n_leaf2 "+" _heightvalue. But what I have tried it gives error in the floor plan, although the 2D script is ok.

	_sPrefixStrings[iContent] = sDescriptionDoorLeavesWidth

	if iDoorLeavesWidth = VALUE_AUTOMATIC then
		_DoorLeavesWidth = ""
		nnn = request ("ASSOCLP_PARVALUE", "gs_list_doorleafwidths", index_ww, type_ww, flags_ww, dim1_ww, dim2_ww, _DoorLeavesWidth)
		nnn = request ("ASSOCLP_PARVALUE", "ac_unit_height", index_ww, type_ww, flags_ww, dim1_ww, dim2_ww, _heightValue)

		if bDefaultElem then
			_sContentStrings[iContent][1] = _stLocNoContent 	! "<no content defined>"
		else
			_sContentStrings[iContent][1] = _DoorLeavesWidth
			_sContentStrings[iContent][1] = _heightValue
		endif
	else
		_sContentStrings[iContent][1] = sValueDoorLeavesWidth
	endif

return

 

Solution

I guess it is all related to the original question so we will leave it together.

First ...

BarryKelly_0-1644311814828.png

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.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Awesome, I think I got the hang of it. Thank you so much. 👍

Now everthing is up and running.

 

Can I accept two solutions in the same topic?


@jc4d wrote:

Can I accept two solutions in the same topic?


I believe so.

 

Barry.

 


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!