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

Text File (database) INPUT/READ for a calculating object (?)

Anonymous
Not applicable
Hi All!
OK, I give up -
FILE I/O is driving me nuts!
Attached is a sample text file that was generated by a simple
LIST scheme.
It lists certain attributes of given objects that are placed on the plan view
of a story, with discreet layers and IDs set to each object.

My goal is to create a "Calculating and Report" object that will be
able to READ this file, perform certain summing and subtracting
operations and generate a 2D "Report Object".

Let me explain what you are looking at:
GF is the Ground Floor story, in this case all objects are on it.
|XX| are the various layers.
I would need to generate a graphic list of all objects on layer |01|,
sorted by ID (next field from the layer), display the math routine
per object, display the result of each routine, and then display
the SUM of results for all these routines.

I know this should be achievable via TEXT or DATA file INPUT or READ,
and should use Arrays in some way with a counter loop,
but besides looping my CPU up to 57% I am going nowhere...
and this is with Cookbook 2, GDL reference manual and Andy Watson's
GDL Handbook.

If anyone out there has the time to explain this at idiot-speak level,
it would be much appreciated and you would be blessed with good fortune,
many children and a happy wife!!!

🙂
Gil

Database2.jpg
5 REPLIES 5
Anonymous
Not applicable
PS: Take note that the combination of Story, Layer & ID form
a very discreet triple power ID for each row in the file -
which is the key to making this data useful...
🙂
Jochen Suehlo
Moderator
Try this part of script, which I did not tested, but I think it should work:

DIM mti[][5] !Array for storing the values of the text file

ix=0
ch01 = OPEN("TEXT","C:\GDL\DATA\Database2.txt","SEPARATOR='|',MODE=RO,FULLPATH")
DO
ix=ix+1 !ix is the variable linecounter, 5 columns are given
n=input(ch01, ix, 1, mti[ix][1], mti[ix][2], mti[ix][3], mti[ix][4], mti[ix][5])
WHILE n>-1
close ch01

manu=ix-1 !number of Array lines with content
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Anonymous
Not applicable
Hi Joachim,
I managed to get things working, sort of.

How can I get an array to store something like the
following string, which appears on th 4th column of the source file
(( 1.00+ 0.00) /2) * 1.00
as text? (brackets, spaces, operators etc - all as a text string)?

I tried setting the variable to text, directly (var1=abc)
and also via the parameters - but I keep getting "1" as a result.

???

🙂
Gil
Jochen Suehlo
Moderator
With that script I get as result 0.5 , which is the correct calculation, and not 1.
If you want to have the formula, you must write in the textfile
"(( 1.00+ 0.00) /2) * 1.00"
with quotes.
In the gsm you must then delete the quotes with a string-operation.
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Anonymous
Not applicable
Hi Joachim,
Thanks - I did something very similar,
you can see in my newest plea for more help - LOL!
🙂
Gil