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

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Excel to Object GDL

Anonymous
Not applicable
Has anyone successfully updated GDL parameters, from data from an excel spreadsheet?
I gather this can be done via XML.
Just trying to find an example file to determine if and how it can be done.
10 REPLIES 10
Pertti Paasky
Expert
Have look at this object:OpenLibraryGlobals.GSM
You find it here:
http://www.opengdl.org/Default.aspx?tabid=4750&language=en-US
The object can't be placed in the floor plan, open it from the library.
The library is type of .lcf, which must first be converted to a normal library)
The object reads a projectinfo file (.xml-file which has been saved from Archicad project-info tab) ,and turns it into parameters' values.
You can use this method for your custom objects.

There´s another method in Special menu. You can export objects to xml and import them. Just manipulate the xml file and you get objects on the floorplan with parameters you have changed in the xml-file.
Have nice moments with these.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
sinceV6
Advocate
Hi.
Another option would be using plain text files (maybe CSV) exported from excel; and use the channel->OPEN command.
It works nicely.
Anonymous
Not applicable
I've used plain text files created from excel spreadsheets (either exported as tab-delimited-text or just copied and pasted into Notepad/TextEdit) to read a database of Keynotes. It's allowed me to edit a whole page of notes nicely formatted for the page in ArchiCAD by quick edits of a single text file or spreadsheet, then click on the Update button, and the whole thing gets updated and formatted. I use the same database for a Keynote label tool. I'm sure I've replicated what Cadimage did with their Keynotes tool (and in an inferior way) but by the time I found out they had one, I'd already written it.
Anonymous
Not applicable
Thankyou for everyone's responses
I will give the plain text files a go first. It sounds powerful and hopefully my brain will keep ticking after I work out the code
Anonymous
Not applicable
OK, sorry to reopen this.
I have been searching forums, but still struggling.

What I want to do is read the values of a tab illuminated text file
example
test.txt
aa 11 22
bb 33 44
cc 55 66
... ... ....


I might end up having 80 rows, and I want to read these just for a label.
I am trying to work out how to use the open and input commands to read these values.
Would I need to create parameters for each field I want to read.

This is what I have put together, which doesnt work in the slightest

ch1=OPEN("TEXT",test.txt,"SEPARATOR='\t',MODE=RO,LIBRARY")
n=input(ch1,1,1,var1,var2,var3)
n=input(ch1,1,2,var4,var5,var6)
n=input(ch1,1,3,var7,var8,var9)
close ch1

I know I am way off, but struggling to understand the principals.
There isn't enough object examples out there
sinceV6
Advocate
Hi.
This is one of the many code snippets found in this great forum. I've found it pretty handy to remember how to read from text files. The GDL reference is quite technical and complete, but not user friendly.

Perhaps this can help you understand the basics and move from there... it sure did help me. I don't remember who posted it though.
! Example to read all string values from a file
! and use it in a value list
DIM sarray[]
! file in the library, containing parameter data
filename = "ProjectNotes.txt"
ch1 = OPEN ("text", filename, "MODE=RO, LIBRARY")
i = 1
j = 1
sarray[1] = ""
! collect all strings
DO
	n = INPUT (ch1, i, 1, var)
	IF n > 0 AND VARTYPE (var) = 2 THEN
		sarray = var
		j = j + 1
	ENDIF
	i = i + 1
WHILE n > 0
CLOSE ch1
! parameter popup with strings
I used this to learn and script a "text notes" object that reads any tab-separated text file to show different tabulated data, regardless of row/column count.
Hope it helps.
Best regards.
Anonymous
Not applicable
Coming back to this post.
Hoping someone can help me.

I cannot work out how to read a text file into a pulldown window in an object.
Is that possible? The pulldown window may have a different number of fields depending on the text file, not sure if this is an issue setting the size of the array. I assume arrays are static sizes.

Any help would be appreciated
Thanks

Tom
JGoode
Expert
This might be of use. http://gdl.graphisoft.com/tips-and-tricks/how-to-read-and-write-text-files
Tom wrote:
Coming back to this post.
Hoping someone can help me.

I cannot work out how to read a text file into a pulldown window in an object.
Is that possible? The pulldown window may have a different number of fields depending on the text file, not sure if this is an issue setting the size of the array. I assume arrays are static sizes.

Any help would be appreciated
Thanks

Tom
ArchiCAD 23

Windows 10
Anonymous
Not applicable
Thankyou,
I was referring to this but it seems to have a fixed array size of 7.
Makes me think I cannot have a pulldown box with a different size depending on the size of input text file
Tom