cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

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

help with zone object

jkershaw
Enthusiast
Ok, please forgive my newbie-ness.

I'm attempting to modify an existing zone stamp so that it can actively calculate an occupant load based on the room area and the occupant load factor. It works great until the room gets to be over 1000 SF. Please see image below.


here's the code:

! ====== Place Occupant Text ===================
IF showLoad THEN
rrr=REQUEST ("Area_dimension","",area_form)
room_area = STR (area_form, ROOM_AREA)
net_area_val = ""
n = SPLIT(ROOM_AREA,"%n",net_area_val)
occLoad = STR (CEIL(net_area_val/SqFtPerson),1,0)

TEXT2 0,-vOffset, "Occupant Load: " + occLoad
HOTSPOT2 0,-(vOffset)-(strHt2/2)
vOffset=vOffset+strHt2
ENDIF



I suspect it's something in the SPLIT command, but quite frankly, I'm lost. Any help would be greatly appreciated!

Picture 6.png
AC26 APPLE SILICON USA FULL 4032
Mac Studio 2022, Apple M1 Max, 64GB RAM
13.2 macOS Ventura
learning AC since version 4.5
3 REPLIES 3
Laszlo Nagy
Community Admin
Community Admin
Maybe it has something to do with the comma at the thousand place. It cannot deal with it because a comma is not a number so it takes the '1' at the beginning of the string.
You can check this: maybe beyond 2000, the result will be 2.
You should use string operations to strip the comma out of the string and then do the calculation.
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
David Maudlin
Rockstar
jkershaw:


Laszlo is on the right track. The square footage is being returned as a text string, not a number, so the comma will split the string when present when the square footage equals or exceeds 1,000. So you can try:
IF showLoad THEN 
rrr=REQUEST ("Area_dimension","",area_form) 
room_area = STR (area_form, ROOM_AREA) 
net_area_val = "" 
n = SPLIT(ROOM_AREA, "%n%s%n", net_area_val2, comma, net_area_val1) ! n = SPLIT(ROOM_AREA,"%n",net_area_val) 
net_area_val = net_area_val2 + net_area_val1
occLoad = STR (CEIL(net_area_val/SqFtPerson),1,0) 

TEXT2 0,-vOffset, "Occupant Load: " + occLoad 
HOTSPOT2 0,-(vOffset)-(strHt2/2) 
vOffset=vOffset+strHt2 
ENDIF 
Where "%n%s%n" is picking up the comma between the thousands and hundreds. This is rough, there may be further refinements depending on your desired result.

You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this forum.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC28 USA • Mac mini M4 Pro OSX15 | 64 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
jkershaw
Enthusiast
Laszlo and David -

Thank you SO much for your replies! That is extremely helpful in understanding how to properly parse the string into the component parts. I will give it a shot!
AC26 APPLE SILICON USA FULL 4032
Mac Studio 2022, Apple M1 Max, 64GB RAM
13.2 macOS Ventura
learning AC since version 4.5