cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

GDL
About building parametric objects with GDL.
SOLVED!

Macro not called

jc4d
Expert

Hello,

I have defined a set of values on the parameters tab and to make it easier to use subroutines in the 3D I have a variable in Master to do it, the problem is when I test it, the call is not made and I get and error in the 3D script saying that there is a uninitialized variable.

 

The exact problem is in the 3D script, if I call the subroutine +dort which is defined in the Master, the macro is not called, but the other calls are working.

If I delete the +dort then the macro is called if I set gosub 202

 

Here is just an extract of the code:

 

Parameters tab:

VALUES "ls" "Empty", "Flush", "1-panel"

Master:

lw=A-2*frw
lh=B-frw

IF opa3>90 THEN opa3=90
IF opa3<0 THEN opa3=0

IF ls="Empty"		THEN dort=0
IF ls="Flush"		THEN dort=1
IF ls="1-Panel"		THEN dort=2

3D script:

ADDx lw/2
ROTy -opa3
GOSUB 200+dort
DEL 2

DEL TOP
END

200:
!!! EMPTY WHOLE
RETURN

201:
MATERIAL lmat1
PUT 0,0,15,
0,lh,15,
-lw,lh,15,
-lw,0,15,
0,0,-1
PRISM_ NSP/3,lt,GET(NSP)
RETURN

202:
CALL door01_macro PARAMETERS lmat1=lmat1, lmat2=lmat2, lw=lw, lh=lh, lt=lt
RETURN

 

 Juan.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Before your if statements for dort, add dort =0

This initializes the parameter. 

I'd you have it as an actual parameter for the object then you need to push your value back to the parameter.

View solution in original post

3 REPLIES 3
Solution

Before your if statements for dort, add dort =0

This initializes the parameter. 

I'd you have it as an actual parameter for the object then you need to push your value back to the parameter.

DGSketcher
Legend

@jc4d The code checking does not see the dort value as it is conditional within the if statement. I'm no big coder and I regularly get caught out by this. Just follow the good advice above by @SenecaDesignLLC  

 

Couple of other things...

You could set the Dort = 0 in which case you shouldn't need to reset it with [IF LS = "Empty"...]

Have a look at the Values{2} command to set the Dort parameter in the parameter script

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
jc4d
Expert

Thank you both for chime in, you are right I had to define the dort first.

And I just noticed that the values I had the name "1-panel" and in the master I had "1-Panel" that capital letter was the error.