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

GDL IN/OUT and Arrays

Matthew Johnson
Advocate
Trying to update our zone GDL to automatically calculate occupancy numbers using use tables from the Building Code. I'm using an external text file to hold the table data so that it can be updated if the Building Code changes.
!-- Getting NCC Table D1.13 values

dim value_use[], value_rate[]

filename= "NCCTableD113.txt"
ch1=OPEN("TEXT",filename,"SEPARATOR='\t',MODE=RO,LIBRARY")

!--counting the total number of rows
row=0
do
row= row+1
n=INPUT(ch1,row,1,string1)
while n>-1

!--reading the first column for NCC_TableD113_Use
for k= 1 to row-1
n=INPUT(ch1,k,1,string1)
value_use= string1
next k

!--reading the second column for NCC_TableD113_Rate
for m= 1 to row-1
n=INPUT(ch1,m,2,string2)
value_rate= string2
next m

CLOSE (ch1)

VALUES "NCC_TableD113_Use" value_use, custom
Not having done much work yet with arrays I'm now stuck as to the next step to use the value the user selects from the drop down for NCC_TableD113_Use to select the matching value for the NCC_TableD113_Rate.

Can anyone suggest some code or point me in the right direction for a guide for this?
Matthew Johnson - POWE Architects
AC4.5 --> AC27 & Revit 2019 --> 2023
Asus Zenbook Pro 16x i9-13900H w/ Nvidia RTX 4070 4K dual, Windows 11 64bit
I'd rather be sailing.
3 REPLIES 3
Anonymous
Not applicable
Hello,

If you are just filling the NCC_TableD113_Rate with the chosen NCC_TableD113_Use then
this should do the job.

Two parameters needed; NCC_TableD113_Use (string) and NCC_TableD113_Rate (number)

!-- Getting NCC Table D1.13 values 

dim value_use[], value_rate[] 

filename= "NCCTableD113.txt" 
ch1=OPEN("TEXT",filename,"SEPARATOR='\t',MODE=RO,LIBRARY") 

!--counting the total number of rows
do
row= row+1
n=INPUT(ch1,row,1,string1)
while n>-1

!--reading the first column for NCC_TableD113_Use
for k= 1 to row-1
	n=INPUT(ch1,k,1,string1)
	value_use= string1
next k
values "NCC_TableD113_Use" value_use, custom

!--reading the second column for NCC_TableD113_Rate 
for k= 1 to row-1
	n=INPUT(ch1,k,1,string1,string2)
	if NCC_TableD113_Use = string1 then
		values "NCC_TableD113_Rate" string2
	endif
next k

CLOSE (ch1)

Hope this works.

PS. What kind of a boat are you sailing?
Matthew Johnson
Advocate
Juha,

Thanks for the assist. Works well and simple code keeps it tidy.

PS: the avatar is the sail from my Cobra catamaran. Don't get to sail it much since I had my ankle reconstructed. Spend most of my spare time now teaching kids to sail.
Matthew Johnson - POWE Architects
AC4.5 --> AC27 & Revit 2019 --> 2023
Asus Zenbook Pro 16x i9-13900H w/ Nvidia RTX 4070 4K dual, Windows 11 64bit
I'd rather be sailing.
Anonymous
Not applicable
Nice to hear that the problem was solved.

Sorry about the ankle...as they say: "keelboats are for elderly
people" 😉

Regards, Juha