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

Retrieving data with GDL Data Add-On

Miquel Garcia
Contributor
I'm writing a script to allow an object to read data from the zone where it lies and to relate it with a data file. The name of the data file must be extracted from the zone name. But I have a message when I save the object, saying that 2D script contains errors, although the check script is ok. It seems that the zone name is not correctly stored and it cannot be used to define the name to read the data file.

I'm writing that:

z_name=""
z_number=""

rr= REQUEST ("Zone_relations", "", z_category_name, z_code, z_name, z_number)

file_name=z_name + ".txt"


ch=OPEN("DATA", file_name,"SEPARATOR='\t', MODE=RO, Library")
nr=INPUT(ch, z_number, 1, Cate1, Cate2, Cate3, Cate4, Cate5)
CLOSE ch

Any ideas? I'm tried to store the zone parameters in an array, but with the same result. The script works well when I'm writing manually the name of the file, but gives the error when I'm using the requested zone parameter.
Miquel
Capella & Garcia Arquitectura
AC18 - AC21, iMac 27" 3.1 Ghz Intel Core i7, 16GB Ram, OSX 10.13.1
3 REPLIES 3
Save the file anyway.
The problems with such scripts (requesting another object) is that inside GDL editor You do not have the requested file 😉

Best Regards,
Piotr
Miquel Garcia
Contributor
I know it. To verify the functionality I have a placed object over every different zone. When I save the file, the placed objects misses its 2D.
Miquel
Capella & Garcia Arquitectura
AC18 - AC21, iMac 27" 3.1 Ghz Intel Core i7, 16GB Ram, OSX 10.13.1
Miquel Garcia
Contributor
The main problem is that the name of the data text must begin by a letter, an not by a number. My data text had a numeric index at the beginning.

I'm now writing this workaround, but it only works in the parameter script:

z_name=""
z_number=""

Cate1=""
Cate2=""
Cate3=""
Cate4=""
Cate5=""


rr= REQUEST ("Zone_relations", "", z_category_name, z_code, z_name, z_number)

parameters SECC=z_name, MND=z_number, NARCH=z_name

codNumZ=strsub (z_name,1,3) !Numeric code from zone name

if codNumZ="152" then !File selection by numeric code
NARCH="Nuestra Casa"
endif


ch=OPEN("DATA", NARCH,"SEPARATOR='\t', MODE=RO, Library")
nr=INPUT(ch, MND, 1, Cate1, Cate2, Cate3, Cate4, Cate5)
CLOSE ch

parameters CTGR1=Cate1,CTGR2=Cate2,CTGR3=Cate3,CTGR4=Cate4,CTGR5=Cate5

any attempt to directly use the read parameters from the zone as a file name makes the object unusable.

A better workaround would be very helpful, thanks!
Miquel
Capella & Garcia Arquitectura
AC18 - AC21, iMac 27" 3.1 Ghz Intel Core i7, 16GB Ram, OSX 10.13.1