cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Total of array values

Erich
Booster
Ok, I am feeling brain dead at the moment..

Does anyone have a clean method for getting the sum total of all the values in an array?

For example if you a have a 3 dimension array with values of 2'-0": 1'-4": 2'-3" I need the result of 5'-7"
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
3 REPLIES 3
Karl Ottenstein
Moderator
Not sure what you mean by "clean", Erich. Do you want something more than just a loop, iterating through the indices and summing things up?

Cheers,
Karl

PS I've been brain dead for two days, so can commiserate. 😉
AC 28 USA and earlier   •   macOS Sequoia 15.3, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
One of the forum moderators
Frank Beister
Moderator
dim var[3][4]

result=0
for i=1 to vardim1(var)
for j=1 to vardim2(var)
result=result+var
next j
next i

print result
text2 0,0,result
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Erich
Booster
Thanks guys. My new son is making sure I can't think straight anymore and I couldn't figure out how to get my loop to work right. Frank hit it right on the nose. I just needed the dummy variable to be the place holder in the loop.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K