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

Getting the Story Index Number

TomWaltz
Participant
I am trying to make Zones that are sensitve the the story they are placed on (for use in modules placed on multiple floors), and I am having trouble figuring out how to get the Index Number of the story.

I found the reference for
REQUEST  ("Story", "", index, story_name)
in the GDL reference manual, but I'm not really sure what to do with it from there.

I tried using the index in the context of
Zname = index + Zname 
, but Archicad gives me an error "Unused function return value."

Can anyone shed some light on this for me?

Thanks!
Tom Waltz
4 REPLIES 4
TomWaltz
Participant
sorry, that should have been
ROOM_NUMBER = sindex + ROOM_NUMBER
not zname.
Tom Waltz
Anonymous
Not applicable
Tom,

For some reason you always have to set a variable equal to the Request function, i.e.:
story_ID_OK = REQUEST  ("Story", "", story_index, story_name)
Otherwise you get the error message. It actually does not interfere with the function of the part. The error only shows up when you check scripts.

Generally I think the return value is 1, 0, or -1 depending on the Request function. I have rarely (if ever) used this value so I generally just put a dummy variable in to make the error go away.

The variable story_index will contain the number of the story but this may not match the story structure of your building. You may need an adjustment parameter for those cases.
TomWaltz
Participant
That was it.

Here is how it ended up:
story_ID_OK = REQUEST  ("Story", "", story_index, story_name)
! adjust +1 for Euro-style flr numbers
IF story_index < 0 THEN
	Fix_Val = 0
ELSE
	Fix_Val = 1
ENDIF 
ROOM_NUMBER = STR (story_index+Fix_Val,1,0) + ROOM_NUMBER
Tom Waltz
Laszlo Nagy
Community Admin
Community Admin
I think the reason you have to assign the return value of a REQUEST function to a variable is so that you are able to evaluate whether the REQUEST function was successful or not. If there was some error, the REQUEST function will return the value -1. Otherwise it will return the number of values filled into the variables named in the REQUEST function (this number can be different with each different REQUEST function).
This way of operation may be useful for debugging your GDL code.
Laszlo
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28