Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Variable Not Setting

Anonymous
Not applicable
In a GDL I have a parameter named pPlatLen that is a text variable.

In the PARAMETER script I have:

VALUES `pPlatLen` `48"`, `56"`, `60"`

In the MASTER script I have:

!!SET NUMERIC VARIABLE BASED ON TEXT VARIABLE VALUE
IF `pPlatLen` = `48"` THEN
PlatLength = 48"
ENDIF
IF `pPlatLen` = `56"` THEN
PlatLength = 56"
ENDIF
IF `pPlatLen` = `60"` THEN
PlatLength = 60"
ENDIF


In the 2D script I have:

<...snip...>
LINE2 PlatLength + 1", 0'-0.0000", PlatLength + 3'-1", 0'-0.0000"
LINE2 PlatLength + 3'-1", 0'-0.0000", PlatLength + 3'-1", 4'-3.0000"
LINE2 PlatLength + 3'-1", 4'-3.0000", PlatLength + 1", 4'-3.0000"
LINE2 PlatLength + 1", 4'-3.0000", PlatLength + 1", 0'-0.0000"
<...snip...>


The problem is that the 2D script ALWAYS believes that PlatLength is 0". Why isn't the MASTER script assigning the values properly? I can change the value of pPlatLen all day and nothing changes.

If I put PlatLength = 48" in the 2D script right before the LINE2 calls, everything works great.

What mysterious secret am I missing?!?
6 REPLIES 6
Anonymous
Not applicable
You are trying to set a numeric variable from a text variable.
Maybe you should use a function to change the text to a number
I am not very sure about this but i have found the same problem in VB6 so maybe is the same.
Did you made this code?
Anonymous
Not applicable
I built it myself. I even tried making a parameter called PlatLength and setting its value in the MASTER script, but I still got the same result.

I swear I have seen this done before.
Anonymous
Not applicable
If i remember well, GDL use metric system only ,and you can not set it to another.Try to remove the " symbol from the numbers
Anonymous
Not applicable
miker wrote:
If i remember well, GDL use metric system only ,and you can not set it to another.Try to remove the " symbol from the numbers
Nope, in the US version it works in metric -- except for a few functions. But just adding distances works fine.
Frank Beister
Moderator
You have too much quotation marks:

IF `pPlatLen` = `48"` THEN... compares two explicit strings, if they are equal. They aren't, as you see. So the result is in each case zero, which means boolean false. The correct line is IF pPlatLen = `48"` THEN... and compares the content of the string parameter pPlatLen with `48"`. That is, what you wanted.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
F. wrote:
The correct line is IF pPlatLen = `48"` THEN... and compares the content of the string parameter pPlatLen with `48"`. That is, what you wanted.
I swear I tried that yesterday, but just to make sure I tried it again and you're right. Thanks!