2022-04-27 02:32 PM
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.
Solved! Go to Solution.
2022-04-27 03:50 PM
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.
2022-04-27 03:50 PM
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.
2022-04-27 04:01 PM
@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
2022-04-28 08:44 AM
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.