We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Problem with the script of a simple object (IF... THEN)

Anonymous
Not applicable
Hello everyone!

I have a problem with the simple GDL script I wrote. I made these two objects (Table18 and Desk12) based on the same statement (IF... THEN... ENDIF) I found in the book 'Object Making with ArchiCAD- GDL for Beginners' by David Nicholson-Cole.
I attach them both to my post. The Table18.gsm works perfectly fine, the amount of chairs around it is in relation to the width. Desk12.gsm on the other hand doesn't work (even though they're so similar), it stretches only to a point. Also, when the 'Sideboard' parameter is on with the 'desk=11' desk type, the rectangle representing the sideboard flies off awkwardly. If one of you more experienced GDL friends had time to take a look at my makings, that would be more than awesome.

Thank you!

PS I work in ArchiCAD 19, full German version.
iOS X El Capitan 10.11.3
iMac (Retina 5K, 27 Zoll, Ende 2015)
4 GHz Intel Core i7
16 GB 1867 MHz DDR3
AMD Radeon R9 M395X 4096 MB
2 REPLIES 2
sinceV6
Advocate
Hi.
Several things you need to change:

1. Delete the "desk" parameter
2. After the first set of hotspots, define two variables
desk=0
w=0
3. In widths and flags calculations, change all "A"s after "THEN"s to "w". Example:
IF A<1.0 THEN
w=1.0:desk=11
ENDIF
4. Use "w" instead of "A" in RECT2 for the main desk shape.
5. In your "ADD2" when drawing chairs, change "A/2" to "w/2"
6. Since you have two ADD2 transformations in each IF statement, each DEL should be "DEL 2". This is why the sideboard flies away.
7. Sideboard's RECT2 should also use "w" instead of "A"
8. Add "DEL 1" after the sideboard's RECT2 statment.
9. Consider creating a couple of line type parameters and use those in your LINE_TYPE statements, instead of declaring the line type name.

Hope that helps.
Best regards.
Anonymous
Not applicable
Thank you so much for all the suggestions, it worked! I'll take your advice and change the way I set the line types.

Alles gute!