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

GLOB_ID convertion into a real number

Anonymous
Not applicable
Hello world,

I' m making a custom "apartment label" in which object ID is the netto area of the whole apartment (sumed manualy and typed in by hand).
I will need to make a schedule of those apartments with an option to sume the apartments areas.

So what is needed is to convert object ID into a real number which further could be scheduled and sumed up.

I've tried this but it doesn't work:
area = GLOB_ID
n = SPLIT (area, "%n", num)
Text2 0, 0, num
so, the value "num" was supposed to be that "real numebr" which could be multiplied, sumed etc...

The objects ID is for example a text: 38,70 (with a coma typed in on the numpad but could be also a dot)

any ideas ?

The whole object "label" works like this:

AC_ID Question.JPG
7 REPLIES 7
sinceV6
Advocate
Hi.
I'm sure you have a reason, but I would ask why use a manual sum in the ID of the object? It will probably lead to mistakes.

What is it that's not working? Do you get any error messages? Code looks ok, besides maybe the need to initialize the variable. Comma may also create issues. If that's what you use system wise, you could try %^n as the flag.

Best regards.
It is easier to type in the id than the other values...ID tab in InfoBox.

However - if the value must be schedule'able - I would use A or B value instead of the ID - I would leave the ID for the flat ID no.

(the need for such object is because of the lack of the room schedule object plug...apart from the one in Austrian version called TOP Stempel but working with bugs)

Best Regards,
Piotr
Anonymous
Not applicable
Piotr, exactly ! ( dzięki 😉 )

The decision to use ID as the area netto was made by the design team so I can't change it.
In case it doesn't sume up in schedules it will be sumed up by hand in Excel.
This counting by hand is not a problem comparing to typing in the area sume into the object because we are talking here about 500 apartments with areas changing constantly. Those area changes sometimes are not bigger than 0,01m2 but they still have to be counted precisly, very quick and first of all shown on the plan.... schedules are only a secondary information tool.

The lack of a "Master Zone" showing area of few selected zones (each apartment rooms) is a real pain in the ass when it comes to residential design

So.... coming back to the GDL problem...
It looks like the GLOB_ID is a "variable" which can't be recognized as a real number. The code below shows the problem:
area = "7,35"
!area = GLOB_ID !     Object ID is now also 7,35
n = SPLIT (area, "%n,%n", num1, coma, num2)
number = num1 + num2 
Text2 0, 0, number     ! Should be 7+35=42
When AREA is typed in the code by hand as text consisting "7,35" it works, the answer is 42 ( =7+35),

but when AREA is the ID of the object which is also a text "7,35" the SPLIT command seems not to be able to split it into numbers.

Any ideas ?
sinceV6
Advocate
Yes.
I'd say the comma is causing the problems. Try, like I said, with a point. Check this:

HOTSPOT2 0,0
CIRCLE2 0,0,0.10

area = GLOB_ID 
num1 = 0
num2 = 0
n = SPLIT (area, "%n %n", num1, num2)

TEXT2 0, 0, STR(num1,4,2)

IF n=1 THEN
numSum = "double of ID: " + STR(num1*2,4,2)
ELSE
numSum = "sum of numbers in ID: " + STR(num1+num2,4,2)
ENDIF

ADD2 (STW(STR(num1*2,4,2))/1000*GLOB_SCALE)*(n>1) + 0.50,0
IF n > 1 THEN TEXT2 0, 0, STR(num2,4,2)+"<-- second value"
DEL 1

ADD2 0,-0.50
TEXT2 0, 0, numSum
DEL 1
You can type in the ID field:
1
2
etc

1.1
2.1
etc

1 1
1 2
etc (space between characters)

You'll see that the comma breaks the script. If you change the split function to
n = SPLIT (area, "%n,%n", num1, sep, num2)
You'll see it reads two values. Have you tried %^n as I said?

I know typing in the ID field is fast, just wanted to know why in case there was another way of getting what you need.

Still, there are workarounds I would use instead of making sum and typing manually.

1) Are you talking about net area (zones to wall edge)? or gross area (walls included, zones using wall reference line)? If you are using gross area, why not make another zone (manual construction) with no background, just the stamp, that encloses all the zones you want listed. Of course this wouldn't work well (it can be made to though) if the zones are not next to each other. Or...

2) If you are sending views to layouts, why not use schedules to group the areas you want and overlay the sum as if it was part of the stamp?

Just some ideas.

Best regards.
Anonymous
Not applicable
Hi

SinceV6 - thanks alot, it nearly works and your explenation solved most of my concerns.

I'm pretty much a newbie in GDL so sorry for my basic questions.
1. Yes, I've tried %^n instead of %n but without any sensible result, what can it do ?

2. Since the ID is splited and works as numbers I would like to have it in schedule sumed up. So i made :
- in the Parameter section a parameter "area_schedule" which is a "real number".
- Master Script ( or 2D Script) :
!---------------- Master Script ------------

area = GLOB_ID 
num1 = 0 
num2 = 0 
n = SPLIT (area, "%n %n", num1, num2)

PARAMETERS area_schedule = num1

area_text = STR(num1,4,2) 

IF n=1 THEN 
numSum = "double of ID: " + STR(num1*2,4,2) 
ELSE 
numSum = "sum of numbers in ID: " + STR(num1+num2,4,2) 
ENDIF 
- 2D Script:
HOTSPOT2 0,0 
CIRCLE2 0,0,0.10 

TEXT2 0, 0, area_text

ADD2 0,-0.50 
TEXT2 0, 0, numSum
DEL 1 
- Parameter Script:
lock "area_schedule"
and a schedule where I ask for the custom Parameter "area_schedule" to be listed and sumed up.... and it doesn't work, only 0,00 are shown although the object itself shows that "num1" is a real number like 24,5 (for ID=24.5)

But changing from
PARAMETERS area_schedule = num1
to
PARAMETERS area_schedule = 5*6

gives in the schedule numbers 30 as it should.

What am I missing ?
Anonymous
Not applicable
Areas to be listed and sumed up are:
- strictly netto areas of the apartment, for brutto we make a seperate zone
- at this stage of concept design we don't use layouts and even we did we shift the apartments all over the plans all the time so using schedules as Zone stamps on layout would lead very quickly to chaos ... this way of working would collapse after no longer than 3 days
- they have to sume up exaclty as you would do with a calculator (clients usually do that) so 6.32+ 4.45 must equal 10.77 and not 10.76 as sometimes Archicad calculates after rounding up the areas in schedules.

Using the "Basic" List of Zones (bottom of the Model View in Navigator) to get the area sume of selecting Zones is very quick.
Hand retyping just the sumed area into Object ID is propably the quickest option for the moment which can be done by draftsmen with any level of skills in archicad.
Its just very simple...even making simple schedules of areas is for 70% of people to complicated 😕
sinceV6
Advocate
philips wrote:
What am I missing ?
Change the parameter type to Length type. Should work.

Best regards.