Home › Forums › Problems and solutions in GDL › Others › Attempting to add Transformations to IF/THEN statement
- This topic has 5 replies, 4 voices, and was last updated 8 years, 10 months ago by Dominika Bobály.
-
AuthorPosts
-
-
February 18, 2016 at 00:56 #2270Patrick MayParticipant
Sorry for the simplicity of this question; I should know how to do this, but I can’t figure it out. I am building an appliance and want a control to open the lid. I am trying to add a series of transformations into the script but keep coming up with an error. My script as typed is:
IF HoodPosition = “Open” THEN
ROTx 294
ADDz 0′-10 3/4″
ADDy -3′-6 5/32″ ELSE
ENDIF
!script here
DEL TOPThis is giving an error message as soon as I include the ADDy & z commands. Thoughts on what is wrong?
-
February 18, 2016 at 02:40 #2271Barry KellyParticipant
I have never used Imperial measurements in a script but I suspect what you have shown is incorrect.
ADD command requires just one value, you seem to have two for each.
There must be another way of writing it as one figure.Barry.
Versions 6.5 to 22
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit -
February 18, 2016 at 09:25 #2272Joachim SühloParticipant
ELSE must be put into a new line!
GDL Object Developer
b-prisma
MAC OSx 10.14 -
February 18, 2016 at 22:02 #2279Patrick MayParticipant
@joachim, that was it. I eventually tracked that down. Apparently I don’t even need the Else line for this stack to work, I just had it in there by habit.
@barry, imperial feet and inches do work, as long as they are consistent. they can be foot + inch or decimal feet.
Another odd thing about this script is the DEL command. for some reason DEL TOP works, but DEL 3 doesn’t. DEL TOP got the job done, but I’m not sure why I couldn’t be more selective.-
February 22, 2016 at 13:12 #2284Dominika BobályKeymaster
Joachim is quite right.
Another nice way to keep track of your transformation stack is to assign a variable to count every trafo you make:_nTrans = 0 IF HoodPosition = “Open” THEN ROTx 294 ADDz 0′-10 3/4″ ADDy -3′-6 5/32″ _nTrans = _nTrans + 3 ELSE ! whatever, just keep track of transformations here as well, if you use any ENDIF !script here DEL _nTrans
This way you don’t have to use the condition again to enable the DEL command.
Dominika Bobály
Product Manager
GRAPHISOFT SE
-
-
February 18, 2016 at 23:42 #2280Joachim SühloParticipant
DEL 3 works only as follows:
IF HoodPosition = “Open” THEN ROTx 294 ADDz 0′-10 3/4″ ADDy -3′-6 5/32″ ELSE ENDIF !script here IF HoodPosition = “Open” THEN DEL 3
Otherwise you will get an error if the condition is not true.
GDL Object Developer
b-prisma
MAC OSx 10.14
-
-
AuthorPosts
- The forum ‘Others’ is closed to new topics and replies.