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

parametric chair difficulties

Anonymous
Not applicable
Following the 'Intro to object making" guide I have reached to a point with my gdl object where I can't understand the mistake I made, which causes a error message concerning line 31, at the master script check.
I need some help here.All I did was to follow,step-by-step,the exact instructions of the guide.

here is 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

IF bakon=0 THEN arms=0

IF bakon=0 THEN strot=0



!Menu for Chair
cv0='Customised chair'
cv1='Foot stool'
cv2='Nursery chair'
cv3='Piano stool'
cv4='Dining chair'
cv5='Dining armchair'
cv6='Kitchen stool'
cv7='Bar stool'
VALUES 'chairtype', cv0,cv1,cv2,cv3,cv4,cv5,cv6,cv7

IF chairtype<>cv0 THEN
!Grey out custom parameters
LOCK 'stlgth','stwidth','stheight'
LOCK 'lsec','backsec'
LOCK 'bakon','bracetype','backheight','arms'
ENDIF


IF chairtype =cv1 THEN !Footstool
stlgth=0.35: stwidth=0.30: stheight=0.28:
lsec=0.04: backsec=0.04: arms=0
bakon=0: bracetype=bv0
ENDIF

IF chairtype =cv2 THEN !Nursery chair
stlgth=0.30: stwidth=0.35: stheight=0.32:
lsec=0.04: frsec=0.04: arms=0
bakon=1: bracetype=bv0: bheight=0.5
ENDIF

IF chairtype =cv3 THEN !Piano stool
stlgth=0.45: stwidth=0.40: stheight=0.45:
lsec=0.05: backsec=0.1: arms=0
bakon=0: bracetype=bv0
ENDIF

IF chairtype =cv4 THEN !Dining chair
stlgth=0.45: stwidth=0.40: stheight=0.45:
lsec=0.05: backsec=0.05: arms=0
bakon=1: bracetype=bv1: backheight=0.55
ENDIF

IF chairtype =cv5 THEN !Dining armchair
stlgth=0.50: stwidth=0.45: stheight=0.45:
lsec=0.05: backsec=0.05: arms=1
bakon=1: bracetype=bv1: backheight=0.65
ENDIF

IF chairtype =cv6 THEN !Kitchen stool
stlgth=0.35: stwidth=0.40: stheight=0.60:
lsec=0.05: backsec=0.05: arms=0
bakon=0: bracetype=bv2
ENDIF

IF chairtyp =cv7 THEN !Bar stool
stlgth=0.35: stwidth=0.40: stheight=0.65:
lsec=0.05: backsec=0.05: arms=0
bakon=1: bracetype=bv2: backheight=0.3
ENDIF


and here is the 3D script



PEN 1
RESOL 12
!All the legs
MATERIAL lmat

!lsec/3 is the down leg diameter
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx stlgth
CONE lgheight, lsec/3, lsec/2, 90,90
ADDy stwidth
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx -stlgth
CONE lgheight, lsec/3, lsec/2, 90,90
DEL 3

!seat and upholstery

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

!Back Legs, panel and upholstery

IF bakon THEN
MATERIAL framat
ADD 0,stwidth,stheight + stthick + stmatthick
CONE backheight - 0.1,0.03,0.02, 90,90 !leg
ADDx stlgth
CONE backheight - 0.1,0.03,0.02, 90,90 !leg
DEL 2
ADD 0,stwidth-0.02,backheight !back panel
ROTx -2
BLOCK 0.45,backsec,0.35
MATERIAL backmat
ADD 0.05,-0.01,0.02 !back material
BLOCK 0.35,0.01,0.30
DEL 3
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
ADDZ 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
ADDx stlgth
ADDz 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 4
ENDIF


!arms option
IF arms THEN
ADDz backheight !left
ADDy -backheight/6
ROTx -90
MULy 0.5 !Squash the arm cone to an ellipse
CONE stwidth + (backheight/6),lsec/2,lsec/3,90,90
DEL 4
ADDz stheight + stthick + stmatthick
CONE (backheight/3) - 0.06 , lsec/2 , lsec/3 , 90 , 90
DEL 1
ADDx stlgth
ADDz backheight !right
ADDy -backheight/6
ROTx -90
MULy 0.5 !Squash the arm cone to an ellipse
CONE stwidth + (backheight/6),lsec/2,lsec/3,90,90
DEL 5
ADDx stlgth
ADDz stheight + stthick + stmatthick
CONE (backheight/3) - 0.06 , lsec/2 , lsec/3 , 90 , 90
DEL 2
ENDIF
10 REPLIES 10
Anonymous
Not applicable
Seems to work OK for me. Have you added "chairtype" to the list of parameters? I only get an error if this parameter doesn't exist.

I also noticed you have mis-spelled chairtyp =cv7 in the Masterscript. Should be chairtype =cv7.

Hope that sorts it!
Anonymous
Not applicable
thank you for your time,however the problem was the double braces i did't use around "chairtype". it should be

if "chairtype"<>cv0...
if "chairtype"=cv1...
..and so on..

now the problem is that the 3d view of my object does not react to any change of the value of "chairtype"...

i am wondering,does some part of the script need to be written inside the 3d script and some other part inside the master script? is that my mistake?
Anonymous
Not applicable
deinan,

where you have part of the script like this

IF chairtype =cv1 THEN !Footstool
stlgth=0.35: stwidth=0.30: stheight=0.28:
lsec=0.04: backsec=0.04: arms=0
bakon=0: bracetype=bv0
ENDIF

are all these parameters? if so you will need to change the script to read like this

IF chairtype =cv1 THEN !Footstool
parameters stlgth=0.35, stwidth=0.30, stheight=0.28,
lsec=0.04, backsec=0.04, arms=0,
bakon=0, bracetype=bv0
ENDIF

This applies to every other parameter you are trying to change its value in the Parameter or Master Script tabs. If it is a variable however, it does not need to use the parameter command.

Hope that helps...
Anonymous
Not applicable
some of them are variables while some others are parametres.I corrected the script where parameters were involved.still it doesn't work, plus there is an error message,saying that i am using non-necessary symbols at certain places.i couldn't find any of those symbols.

here is an example

IF "chairtype" =cv1 THEN !Footstool
stlgth=0.35, stwidth=0.30, stheight=0.28
lsec=0.04, backsec=0.04
PARAMETERS arms=0, bakon=0, bracetype=bv0
ENDIF

the error message indicates the second line

stlgth=0.35, stwidth=0.30, stheight=0.28

any ideas?
Anonymous
Not applicable
Where you dont use the PARAMETERS command you can use your original script. So replace your , with : as below.

IF "chairtype" =cv1 THEN !Footstool
stlgth=0.35: stwidth=0.30: stheight=0.28
lsec=0.04: backsec=0.04
PARAMETERS arms=0, bakon=0, bracetype=bv0
ENDIF

It may be a personal preference but i would actually write the script like this, much easier to read once you have to find it and read it quickly amoungst hundreds of lines of script.

!Footstool
if "chairtype" =cv1 then

stlgth=0.35
stwidth=0.30
stheight=0.28
lsec=0.04
backsec=0.04
parameters arms=0,
bakon=0,
bracetype=bv0

endif
Anonymous
Not applicable
Thank you,i corrected the symbols,there is no error message now.Still my model doesn't respond though.. I am sending again the current scripts and an image of my variables and parametres,maybe you can help me find the mistake i am making as a newbie..

3d script

PEN 1
RESOL 12

!All the legs

MATERIAL lmat
!lsec/3 is the down leg diameter
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx stlgth
CONE lgheight, lsec/3, lsec/2, 90,90
ADDy stwidth
CONE lgheight, lsec/3, lsec/2, 90,90
ADDx -stlgth
CONE lgheight, lsec/3, lsec/2, 90,90
DEL 3

!seat and upholstery

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

!Back Legs, panel and upholstery

IF bakon THEN
MATERIAL framat
ADD 0,stwidth,stheight + stthick + stmatthick
CONE backheight - 0.1,0.03,0.02, 90,90 !leg
ADDx stlgth
CONE backheight - 0.1,0.03,0.02, 90,90 !leg
DEL 2
ADD 0,stwidth-0.02,backheight !back panel
ROTx -2
BLOCK backlgth,backsec,backlgth-10
MATERIAL backmat
ADD 0.05,-0.01,0.02 !back material
BLOCK 0.35,0.01,0.30
DEL 3
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
ADDZ 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
ADDx stlgth
ADDz 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 4
ENDIF


!arms option
IF arms THEN
ADDz backheight !left
ADDy -backheight/6
ROTx -90
MULy 0.5 !Squash the arm cone to an ellipse
CONE stwidth + (backheight/6),lsec/2,lsec/3,90,90
DEL 4
ADDz stheight + stthick + stmatthick
CONE (backheight/3) - 0.06 , lsec/2 , lsec/3 , 90 , 90
DEL 1
ADDx stlgth
ADDz backheight !right
ADDy -backheight/6
ROTx -90
MULy 0.5 !Squash the arm cone to an ellipse
CONE stwidth + (backheight/6),lsec/2,lsec/3,90,90
DEL 5
ADDx stlgth
ADDz stheight + stthick + stmatthick
CONE (backheight/3) - 0.06 , lsec/2 , lsec/3 , 90 , 90
DEL 2
ENDIF



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

IF bracetype=bv0 THEN
brace=0
ELSE
brace=1
ENDIF
MATERIAL lmat


IF bakon=0 THEN arms=0: strot=0


!Menu for Chair
cv0="Customised chair"
cv1="Foot stool"
cv2="Nursery chair"
cv3="Piano stool"
cv4="Dining chair"
cv5="Dining armchair"
cv6="Kitchen stool"
cv7="Bar stool"
VALUES "chairtype" ,cv0,cv1,cv2,cv3,cv4,cv5,cv6,cv7


!Customized chair
IF "chairtype"<>cv0 THEN
!Grey out custom parameters
LOCK 'stlgth',
'stwidth',
'stheight',
'lsec',
'backsec' ,
'bakon',
'bracetype',
'backheight',
'arms'
ENDIF

!Footstool
IF "chairtype" =cv1 THEN
stlgth=0.35
stwidth=0.30
stheight=0.28
lsec=0.04
backsec=0.04
PARAMETERS arms=0, bakon=0, bracetype=bv0
ENDIF

!Nursery chair
IF "chairtype" =cv2 THEN
stlgth=0.30
stwidth=0.35
stheight=0.32
lsec=0.04
frsec=0.04
bheight=0.5
PARAMETERS arms=0, bakon=1, bracetype=bv0
ENDIF

!Piano stool
IF "chairtype" =cv3 THEN
stlgth=0.45
stwidth=0.40
stheight=0.45
lsec=0.05
backsec=0.1
PARAMETERS arms=0, bakon=0, bracetype=bv0
ENDIF

!Dining chair
IF "chairtype" =cv4 THEN
stlgth=0.45
stwidth=0.40
stheight=0.45
lsec=0.05
backsec=0.05
backheight=0.55
PARAMETERS bakon=1, bracetype=bv1, arms=0
ENDIF

!Dining armchair
IF "chairtype" =cv5 THEN
stlgth=0.50
stwidth=0.45
stheight=0.45
lsec=0.05
backsec=0.05
backheight=0.65
PARAMETERS bakon=1, bracetype=bv1, arms=1
ENDIF

!Kitchen stool
IF "chairtype" =cv6 THEN
stlgth=0.35
stwidth=0.40
stheight=0.60
lsec=0.05
backsec=0.05
PARAMETERS bakon=0, bracetype=bv2, arms=0
ENDIF

!Bar stool
IF "chairtype" =cv7 THEN !Bar stool
stlgth=0.35
stwidth=0.40
stheight=0.65
lsec=0.05
backsec=0.05
backheight=0.3
PARAMETERS bakon=1, bracetype=bv2, arms=0
ENDIF
Anonymous
Not applicable
the image
Anonymous
Not applicable
In trying to run the script there seems to be alot of errors. You can check these by clicking on "check script" at the top of each script. It will tell you the line number where the problem is. I wont try and fix them all but will leave it with you to go through them all.

In terms of changing the "chair type" there were a few places where you had the parameters and variable command mixed up. Any changes you want to make to a parameter listed in the object you need to use the PARAMATER command. Any not listed as parameters you dont need it. I have fixed these and rewritten this part so the values of the chair type work correctly

IF bakon=0 THEN !!!!!!!!!!!!!!!Need to put on separate lines and missing endif
arms=0
strot=0
ENDIF

!!Menu for Chair
!cv0="Customised chair"
!cv1="Foot stool"
!cv2="Nursery chair"
!cv3="Piano stool"
!cv4="Dining chair"
!cv5="Dining armchair"
!cv6="Kitchen stool"
!cv7="Bar stool"
!VALUES "chairtype" ,cv0,cv1,cv2,cv3,cv4,cv5,cv6,cv7

!Rewrite the above to
VALUES "chairtype" "Customised chair",
"Foot stool",
"Nursery chair",
"Piano stool",
"Dining chair",
"Dining armchair",
"Kitchen stool",
"Bar stool"


if chairtype="Customised chair" then chairtypefinal="cv0"
if chairtype="Foot stool" then chairtypefinal="cv1"
if chairtype="Nursery chair" then chairtypefinal="cv2"
if chairtype="Piano stool" then chairtypefinal="cv3"
if chairtype="Dining chair" then chairtypefinal="cv4"
if chairtype="Dining armchair" then chairtypefinal="cv5"
if chairtype="Kitchen stool" then chairtypefinal="cv6"
if chairtype="Bar stool" then chairtypefinal="cv7"


!Customized chair
IF chairtypefinal <> "cv0" THEN !!!!!!!!!!!!remove brackets and changed variable
!Grey out custom parameters
LOCK 'stlgth',
'stwidth',
'stheight',
'lsec',
'backsec' ,
'bakon',
'bracetype',
'backheight',
'arms'
ENDIF

!Footstool
IF chairtypefinal = "cv1" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.35,
stwidth=0.30,
stheight=0.28,
lsec=0.04,
backsec=0.04,
arms=0,
bakon=0,
bracetype=bv0
ENDIF

!Nursery chair
IF chairtypefinal ="cv2" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.30,
stwidth=0.35,
stheight=0.32,
lsec=0.04,
arms=0,
bakon=1,
bracetype=bv0

bheight=0.5
frsec=0.04
ENDIF

!Piano stool
IF chairtypefinal ="cv3" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.45,
stwidth=0.40,
stheight=0.45,
lsec=0.05 ,
backsec=0.1 ,
arms=0,
bakon=0,
bracetype=bv0
ENDIF

!Dining chair
IF chairtypefinal ="cv4" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.45,
stwidth=0.40,
stheight=0.45,
lsec=0.05,
backsec=0.05,
backheight=0.55,
bakon=1,
bracetype=bv1,
arms=0
ENDIF

!Dining armchair
IF chairtypefinal ="cv5" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.50,
stwidth=0.45,
stheight=0.45,
lsec=0.05,
backsec=0.05,
backheight=0.65,
bakon=1,
bracetype=bv1,
arms=1
ENDIF

!Kitchen stool
IF chairtypefinal ="cv6" THEN !!!!!!!!!!!!changed
PARAMETERS stlgth=0.35,
stwidth=0.40,
stheight=0.60,
lsec=0.05,
backsec=0.05,
bakon=0,
bracetype=bv2,
arms=0
ENDIF

!Bar stool
IF chairtypefinal ="cv7" THEN !Bar stool !!!!!!!!!!!!changed
PARAMETERS stlgth=0.35,
stwidth=0.40,
stheight=0.65,
lsec=0.05,
backsec=0.05,
backheight=0.3,
bakon=1,
bracetype=bv2,
arms=0
ENDIF


Good luck!
Anonymous
Not applicable
Thank you for your assistance. However i did chech my script several times and the answer was "the gdl script is ok". Now that is strange. I will check the script carefuly and fix it as you say.I confess that i didn'it know some of the rules ,nor did i read them anywhere inside my gdl guide. I am not very satisfied with the guide since i needed external help several times.Anyway,I am going through the script once again.Hope it works!