BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

gdl scripting problem

Anonymous
Not applicable
hi,am a gdl newbie and i am currently working on creating a parametric gdl chair,the one which is instructed inside the gdl guide of archicad 12.Everything went just fine so far, the guide is pretty helpful. My problem is that I 've reached to a point where i am trying to create an "O brace" option for my chair, but i can't seem to move the 3D cursor correctly.
Each ADD or ROT command i use to create the last 2 braces ends up moving or rotating the whole chair! What am i going to do!?!?
5 REPLIES 5
Anonymous
Not applicable
Nice looking chair!

Firstly I'd check to see if you have too many (or not enough!) DEL's in the script. Carefully count the transformations and compare to the number of DELs.

If you're still having problems, post up part of the script or attach the object (you will need to zip it first) and someone will be able to give you more accurate advice.

Hope that helps.
Anonymous
Not applicable
here is the master script

!Add to the Master Script
!Pop down Menu
bv0="No leg braces"
bv1="O brace"
bv2="H brace"
VALUES "bracetype", bv0, bv1, bv2
IF bracetype=bv0 THEN
brace=0
ELSE
brace=1
ENDIF
MATERIAL lmat


!Braces front to rear
IF bracetype=bv2 THEN !H Brace
ADDz lgheight/3
ADDx lsec/8
ROTx -90
CONE 0.5/2,lsec/4,lsec/3,90,90
ADDz 0.5/2
CONE 0.5/2,lsec/3,lsec/4,90,90
DEL 4
ADD stlgth,lsec/8,lgheight/3
ROTx -90
CONE lgheight/2,lsec/4,lsec/3,90,90
ADDz lgheight/2
CONE lgheight/2,lsec/3,lsec/4,90,90
DEL 3
ADD 0,0.25,lgheight/3
ROTz -90
ROTx -90
CONE stlgth/2,lsec/4,lsec/3,90,90
ADDz stlgth/2
CONE stlgth/2,lsec/3,lsec/4,90,90
DEL 4
ENDIF !brace=bv2

IF bracetype=bv1 THEN !O Brace
ADD 0,0,stheight/3
ROTz -90
ROTx -90
CONE stlgth/2,lsec/4,lsec/3,90,90
ADDz stlgth/2
CONE stlgth/2,lsec/3,lsec/4,90,90
DEL 4
ADD 0,stwidth,stheight/3
ROTz -90
ROTx -90
CONE stlgth/2,lsec/4,lsec/3,90,90
ADDz stlgth/2
CONE stlgth/2,lsec/3,lsec/4,90,90
DEL 4
ENDIF


and the 3d script


PEN 1
RESOL 12
!All the legs
MATERIAL lmat
!lsec/3 is the down leg diameter
RESOL resol1
TOLER toler1
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx 0.45
CONE lgheight, lsec/3, lsec/2, 90,90
ADDy 0.55
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx -0.45
CONE lgheight, lsec/3, lsec/2, 90,90
DEL 3

!seat and upholstery

ADDz stheight
BLOCK stlgth,stwidth,stthick
MATERIAL stmat
ADD 0.025,0.025,0.045
BLOCK stmatlth,stmatwdth,stmatthick
DEL 2

!Back Legs, panel and upholstery
IF bakon THEN
MATERIAL framat
ADD 0,0.55,0.5
CONE 0.6,0.03,0.02, 90,90
ADDx 0.45
CONE 0.6,0.03,0.02, 90,90
DEL 2
ADD 0,0.54,0.70
BLOCK 0.45,0.025,0.35
MATERIAL backmat
ADD 0.05,-0.01,0.02
BLOCK 0.35,0.01,0.30
DEL 2
ENDIF

and the 2d script


!Simple Chair, Parametric 2D Script
HOTSPOT2 0,0 !corner spots
HOTSPOT2 stwidth,0
HOTSPOT2 stwidth,stlgth
HOTSPOT2 0,stlgth
HOTSPOT2 stwidth/2,stlgth/2 !pickup spot
!PROJECT2 3,270,2 !now disabled
s4=lsec/4 !Quarter of diameter
s2=lsec/2 !Half of diameter
PEN 3
CIRCLE2 0,0,s2
CIRCLE2 stwidth,stlgth,s2
CIRCLE2 0,stlgth,s2
CIRCLE2 stwidth,0,s2
LINE2 s2,stlgth-s4, stwidth-s2,stlgth-s4 !back
LINE2 s2,stlgth+s4, stwidth-s2,stlgth+s4 !back
LINE2 0,stlgth-s2,0,s2 !side
LINE2 stwidth,s2,stwidth,stlgth-s2 !side
LINE2 s2,0,stwidth-s2,0 !front

thank you in advance for your time
David Maudlin
Virtuoso
deinan:

The brace code should be in the 3D Script, not the Master Script. The Master Script is run first, so the braces are being created before the rest of the chair, this could be your problem. Move the brace code to the end of the 3D Script and you should be in a better position to understand where the problem is.

As a side note, it would be better to just post the library part, as anyone wanting to run and examine this object would have to replicate all the variables in the Main Library Part Window.

You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this 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
Anonymous
Not applicable
Hi Deinan,

As David suggests, move the brace code into the 3d script. Cutting and pasting it just below the code for the legs will work fine.

This code for the O brace works for me -
IF bracetype=bv1 THEN !O Brace 

ADD 0,0,stheight/3 
ROTz -90 
ROTx -90 
CONE stlgth/2,lsec/4,lsec/3,90,90 
ADDz stlgth/2 
CONE stlgth/2,lsec/3,lsec/4,90,90 
DEL 4 

ADD 0,stwidth,stheight/3 
ROTz -90 
ROTx -90 
CONE stlgth/2,lsec/4,lsec/3,90,90 
ADDz stlgth/2 
CONE stlgth/2,lsec/3,lsec/4,90,90 
DEL 4 

ADD 0,0,stheight/3  
ROTx -90 
CONE stwidth/2,lsec/4,lsec/3,90,90 
ADDz stwidth/2 
CONE stwidth/2,lsec/3,lsec/4,90,90 
DEL 3 

ADD stlgth,0,stheight/3 
ROTx -90 
CONE stwidth/2,lsec/4,lsec/3,90,90 
ADDz stwidth/2 
CONE stwidth/2,lsec/3,lsec/4,90,90 
DEL 3 

ENDIF
There are things you could do to simplify this code, but I have left it as it is for the moment.

A few general comments on the object that also may help you -

- Make the leg height related to the seat height, not a separate parameters eg stheight + 0.02. They will self-adjust automatically if you change the seat height in future.

- The leg positions are hard coded. Make them relate to the seat width eg ADDx stlgth, ADDy stwidth etc.

- stlgth adjusts the seat width. stwidth adjusts the seat depth. This should probably be the other way round to avoid confusion!

- The upholstery is positioned by relating it to just one corner. If the chair size is changed, the upholstery doesn't adjust to compensate correctly. Try starting at the centre of the chair and move it back half the seat width minus 25mm. Don't use separate parameters to control it's size. Use the seat width and length minus 2 x 25mm.

- You don't need both TOLER and RESOL to control smoothness. Stick with just one RESOL at the top of the 3d script for now.

- The back panel dimensions are hard-coded. Try to use existing parameters like the seat width, and leg thickness. You could even create a new backheight parameter.

- Space your code out more to aid clarity.

Hope that helps.
Anonymous
Not applicable
Thank you a lot,everything works just fine now.Thanks for the advice!
Learn and get certified!