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

How to change variables type?

Anonymous
Not applicable
I need to change variable type but don't know how.

for example , from a number to a string or from a string to a number?

Then reason I need this because I need to script something like this


if door_01=1 then
a="abc01def"
gosub 1100
endif

if door_02=1 then
a="abc02def"
gosub 1200
endif
.
.
.
if door_999=1 then
a="abc999def"
gosub 100900
endif

if would be much easier if I use a FOR sentence. but need to do some variables type change I think.

Does anybody know how?

thanks a lot

peter aareas
2 REPLIES 2
Anonymous
Not applicable
Peter,
One way you might try is to use "values" in the parameter script.
Make a text type parameter, name it "dtyp" (or something),
then in the parameters script make a list something like this.

values "dtyp" "door_01",door_2","door_3",...etc

This creates a pull down list in the lib part settings that allows
the user to select a door type.

Then you can use your if statements this way.
if dtyp="door_1" then.....
if dtyp="door_2" then....

There are many other ways but this is an easy one.
Peter Devlin
Jochen Suehlo
Moderator
Or use an ARRAY and try something like this:

DIM door[999]

FOR k=1 TO 999
if door=1 then
a="abc"+STR(k,3,0)+"def"
gosub (k+10)*100
endif
NEXT k
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de