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

Merging an modified GDL with an existing AC file

Hubert Wagner
Participant
Hello :
I've come across this problem quite ofter. Likely it's self-inflicted.

I have a document which contains a number of instances of a GDL part, call it Part 1. I add features to Part 1 and save it as Part 2. I do this because I need to keep the original in case the logic of the modificaiton is misconceive. When the upgrade is working, I replace Part 1 with the modified Part 2 and rename it Part 1

It seems reasonable to suppose the document would merely load Part 1 in the usual awy. However, when I open the document, it ignores Part 1 and instead ask for Part 2 which no longer exists.

How do I persuade the document to use the new version of the GDL?

Best Wishes : Hubert Wagner
8 REPLIES 8
Laszlo Nagy
Community Admin
Community Admin
Read through this article. It includes information about how GDL Objects are identified internally by ARCHICAD. Based on this you can formulate a method that works.:

http://helpcenter.graphisoft.com/guides/gdl-guide-for-archicad-18/chapter-12-miscellaneous/basic-tec...

What I think is that you should not use the Save As command because at the moment the Main ID of the GDL Object will become different and from that point you will not be able to switch between the two version of the object.
Maybe what you should do is to save a copy of Part 1. Then rename it in the file system. I think the Main ID will not change if you rename it this way. Then you can modify the copy in another ARCHICAD instance. And if it works then you always link the copy you need. This way you don't need to change the placed instances from one to the other because in theory they will always use the loaded version (both versions have the same Main ID so they are considered versions of the same object by ARCHICAD). Of course you will have to try it but I think this could be a workable solution.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Hubert Wagner
Participant
Hello Mr Nagy :
Thank you for your response.

If the file ID is the problem, could I copy the contents (text and non-text) from the modified GDL file into the original and save it in the Finder.

Indeed, how does one find and recognize the AC object ID? I've always found the way AC library works to be a mystery.

I've built a number of GDL files as 'objects' which I use as replacements for AC 'columns' and 'beams'. I use these for everything a wooden building I've designed.

The post object allow me to add a tenon to each end and offset if as required. Then I use AC solid operations to cut the mortice into beam objects above and below. The precise length of the latter can be defined automatically depending upon the module selected for the building. Both can be hidden, colored or rendered as 'wood' as required from the GDL.

However, there is always room for improvement. Recently I've been adding more useful bom information. Starting from scratch to redefine all the post and beam objects in a file after an extensive GLD modification is getting rather old.

Regards : Hubert Wagner
Hubert Wagner
Participant
Further to my recent post :

I've tried the copy and past idea, new file into old file. It doesn't work, of course.
I'd be interested to know why.

HW
Laszlo Nagy
Community Admin
Community Admin
OK, I tested it and it works like this.


1. Create your GDL Object.
2. Create a folder on your hard drive (e.g. "Version 1") and save the Object into that folder under a name (e.g. "Object v1.gsm"). Do not save it into the Embedded Library.
3. Link the folder ("Version 1") containing the Object to your Project.
4. Place the Object ("Object v1.gsm").

Now, for its duplicate do the following. This is the critical part for preserving its Main ID:
5. Create another folder on your hard drive (e.g. "Version 2").
6. Copy and Paste the "Object v1.gsm" object from the "Version 1 "folder to the "Version 2" folder. Now you will have a file named "Object v1.gsm" in both folders.
7. Rename the object in "Version 2" folder to something else like "Object v2.gsm".


Renaming a GDL Object in the File system DOES NOT modify its Main ID, so ARCHICAD will still consider it the same object, just a different version of it.
(Using the Save As command from ARCHICAD to save a different version of the file DOES change its Main ID so from that point on it is a different object to ARCHICAD.)
So if you want to create a new version of a GDL Object, DO NOT use the Save As command. Copy-Paste it in the File System and then Rename it as needed. That way the new version will stay the same Object to ARCHICAD.

Now, all you have to do from this point on is to link that folder in the Library Manager that you need.
Need version 1 of the object? Link the "Version 1 "folder containing the "Object v1.gsm" object.
Need version 2 of the object? Link the "Version 2 "folder containing the "Object v2.gsm" object.
You will see that depending on which folder you link, the placed object instance WILL change to "Object v1.gsm" or "Object v2.gsm".

The above also explains why you cannot save the versions into the Embedded Library. If you had both versions of the file in the Embedded Library, they both would be loaded all the time, creating a "Duplicate Object" conflict and it would be up to luck which version ARCHICAD would be using and displaying. By saving them to different folders on your hard drive and always loading the corresponding folder you control which version of the object ARCHICAD will use.

Of course, if you need further versions of the same object, you just need to repeat steps 5.-7.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Hubert Wagner
Participant
Hello Mr Nagy :

Unfortunately the modified GDL object, along with others, already exists.

The two GDLs : v1 and v2, were both created in AC; v2 the modified v1. I assume this means each has a unique ID. It seems to me the only way around this is to do all the modifications again using the v1 file. And do the same for all the others.

I don't work on the original for obvious reaons.

I ought to be able to direct AC to use the new file. I've attempted that of course. All the settings for all the instances of the object in the drawing are lost. AC is looking for the old ID. Still, this seems bizaare.

Surely using the approach you describe could lead to a whole series of folders with many versions of the same GDL. For someone doing a lot of work with this the logistics could become a nightmare.

The central problem is the object ID. If that could be changed would not the difficulty evaporate?

As I understand it, the GDL object has an ID and a body of code. There exists a data file describing the properties of each instance in the drawing.

Surely it is immaterial if today AC opens and runs the code of v1 and tomorrow it runs v2. AC should merely read the data file for each instance and apply it accoringly. The internal logic of the GDL has not changed although a feature or two may have been added. (At this point I reach the limit of my knowledge of the Object programming style).

Further explanation more than welcome.

Regards : Hubert Wagner
David Maudlin
Rockstar
Hubert:

The identification number Laszlo is referring to is the GUID. If you use the Open Object by Subtype command and select a library part, you will see the GUID in the bottom part of the dialog box, which cannot be changed, it is fixed. You cannot do what you describe. You will either need to follow Laszlo's method (which is not really recommended by Graphisoft), or keep a copy of the old script code to copy back into the script windows if the change does not work. This way of uniquely identifying library parts was implemented a long time ago (originally the library part name was used, but this caused many problems when library parts with the same name were loaded at the same time) so you will need to find a method that works with it. There may be a way using development code (C+, not GDL), but that would be a question for the Developer Forum.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Hubert Wagner
Participant
Hello David :
Thank you for your comments.

Mr Nagy said, "Renaming a GDL Object in the File system DOES NOT modify its Main ID..."

This is the important information for me.

The habit of working on a copy of a piece of code, rather than the original was the habit which lead me astray.

Clearly, the best approach is to continually modify the original GDL file.

In future I will make a copy of the GDL to be upgraded and work on that. When I'm satisfied, I'll copy the entire contents of the new back in to the old. I've just done that and, of course, it works well.

So the old file get a shot in the arm and a new lease of life, and I don't end up with a drawing full of objects which need to be redefined.

Thank you both for your assistance.
Best Wishes : Hubert Wagner
France
Karl Ottenstein
Moderator
Somewhat tangential to what you're attempting... do keep in mind that 'parameter transfer' can be used to switch from one object to another (e.g., a different named/GUID object). The key is that the internal variable names for any used parameters should not change (the displayed text prompt is irrelevant).

So, if you have Obj1 and the new Obj2, just select Obj1 in some view, open the object settings (cmd/ctrl-T) and "inject" into the icon representing Obj2, then click OK. The placed Obj1 is now an Obj2 object with all matching parameter values transferred.
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB