Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Macro not called

jc4d
Advocate

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

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.

FREE Soffit & Fascia for Rail Tool - https://bit.ly/BIMRithmSoffitandFascia
FREE wall Accessory framing and coverings - bit.ly/BIMRithmWallAccessories
FREE Truss object - https://bit.ly/BIMRithmTrussV1
FREE Custom Tube Object - https://bit.ly/BIMRithmPolyTube
AC 24, Twinmotion current, Windows 11, Msi 10UG with rtx 3070, wacom intuos pro m, Wacom Cintiq Pro 16, razer Tartarus pro.

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.

FREE Soffit & Fascia for Rail Tool - https://bit.ly/BIMRithmSoffitandFascia
FREE wall Accessory framing and coverings - bit.ly/BIMRithmWallAccessories
FREE Truss object - https://bit.ly/BIMRithmTrussV1
FREE Custom Tube Object - https://bit.ly/BIMRithmPolyTube
AC 24, Twinmotion current, Windows 11, Msi 10UG with rtx 3070, wacom intuos pro m, Wacom Cintiq Pro 16, razer Tartarus pro.

DGSketcher
Rockstar

@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 macOS Monterey / AC25UKI (most recent builds)

jc4d
Advocate

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.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!