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

Using global id as a start for numbering in object

jshuether
Enthusiast
I'm trying to create a object that will number itself in 2D, but the starting number is not always 1 (similar to Parking Place 10.gsm).

for j=1 to n-1
add2 a/n,0
text2 0,0,j+start_num-1
next j
del j-1

start_num is an integer variable.

It works unless I include the following code:

if use_glob_id then
start_num = glob_id
endif
When including this code in the Master Script, despite whether use_glob_id = 1 or 0, I get the incompatible expression types error. What do I have to do to get the numerical number from the glob_id into my text to begin the numbering of my object?

Side note: I've always wanted to be able to add select variables of an object to the Info Box to minimize the opening and closing of dialog boxes.
ArchiCAD 25

Windows 10
2 REPLIES 2
Barry Kelly
Moderator
The GLOB_ID is a string rather than a number.
So I would say you would have to use the SPLIT command to filter out the number component.
However your GLOB_ID will always have to be in the same format - the user can type what ever they want in there.
Type something other than what is expected in the ID and the script won't work again.

I am guessing you would rather use the ID in the info box but you will be better off creating an parameter (integer) in the object that means only a number can be used.
You can even control the range of numbers allowed to block out negatives or zero values.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
jshuether
Enthusiast
I figured it was the SPLIT function, I was just writing it incorrectly. I originally failed to put '%n' in quotes. After a quick check of the GDL Cookbook, I found my error.

The working code is:

if use_glob_id then
x=SPLIT(GLOB_ID,'%n',start_num)
PARAMETERS start_num=start_num
endif
ArchiCAD 25

Windows 10