macro error with adding REALs together...

macro error with adding REALs together...

jsweatherbie
Advocate Advocate
813 Views
7 Replies
Message 1 of 8

macro error with adding REALs together...

jsweatherbie
Advocate
Advocate
//CREATED BY JAMES
//UPDATED 4/18/2024
reset localvars
//
//
//
//SEES IF TOOL IS IN SESSION
IF $SIZE(folder('tool')) == 0 {
MESSAGE WARN "NO TOOL IN SESSION !!!"
FORM RIBBON BACKSTAGE CLOSE IMPORT TEMPLATE PROJECT FILEOPEN
return
}
//SEES IF ANY MODEL IS IN SESSION
IF $SIZE(folder('Model')) == 0 { 
MESSAGE WARN "NO MODEL IN SESSION !!!"
FORM RIBBON BACKSTAGE CLOSE IMPORT MODEL FILEOPEN
return
}


//STRINGS TO MODIFY
//MODIFY THE NUMBERS NOT THE VARIBLES
REAL blockOffset = "$tool.Diameter / 1.25"
REAL zOffset = "0.05"

//RESET BLOCK
EDIT BLOCK ALL UNLOCK
EDIT BLOCK TOLERANCE "0.001"
EDIT BLOCK RESETLIMIT "0"
EDIT BLOCK RESET

//WORKPLANE
MODE WORKPLANE_CREATE "Center Bottom of Block" INTERACTIVE BLOCK
MODE WORKPLANE_CREATE BLOCK XMID YMID ZMIN
ACTIVATE WORKPLANE #

EDIT BLOCK ALL UNLOCK
EDIT BLOCK TOLERANCE "0.001"
EDIT BLOCK RESETLIMIT "0"
EDIT BLOCK RESET

ROTATE TRANSFORM TOP

//ASKS FOR MEASURMENTS OF BLOCK
REAL xAxis = input "Whats the X-Length"
REAL yAxis = input "What's the Y-Length"
REAL zAxis = input "What's the Z-Height"

//SET BLOCK BACK TO MEASURMENTS
EDIT BLOCK ZMIN LOCK
EDIT BLOCK ZLEN "$zAxis + $zOffset"
EDIT BLOCK ZMAX LOCK

EDIT BLOCK YLEN "$yAxis - $blockOffset"
EDIT BLOCK XLEN "$xAxis - $blockOffset"


//BOUNDARY CREATION
CREATE BOUNDARY "Roughing Outside" BLOCK FORM BOUNDARY
EDIT BOUNDARY "Roughing Outside" CALCULATE
EDIT BOUNDARY ; ACCEPT BOUNDARY ACCEPT

EDIT BLOCK YLEN $yAxis
EDIT BLOCK XLEN $xAxis

 

This code errors at LINE #55 ( EDIT BLOCK YLEN "$yAxis - $blockOffset" ) 

 

is it because its a real not a string ? 

0 Likes
Accepted solutions (1)
814 Views
7 Replies
Replies (7)
Message 2 of 8

ondrej.mikulec
Advocate
Advocate

It is because the "$yAxis - $blockOffset" is a string and don't do any computation. To insert that into the command you need to use ${$yAxis - $blockOffset}.

EDIT BLOCK YLEN ${$yAxis - $blockOffset}
0 Likes
Message 3 of 8

jsweatherbie
Advocate
Advocate

jsweatherbie_0-1713563996739.png

 

0 Likes
Message 4 of 8

jsweatherbie
Advocate
Advocate
didnt work still errored
0 Likes
Message 5 of 8

ondrej.mikulec
Advocate
Advocate

double check the $ at the yAxis

0 Likes
Message 6 of 8

jsweatherbie
Advocate
Advocate
i did and nothing changed . same error and i made sure it was "${$yAxis - $blockOffset}"
0 Likes
Message 7 of 8

jsweatherbie
Advocate
Advocate
i feel so dumb now.... i realized that i didnt have any tool selected while running this so it obviously would of errored out . sorry
0 Likes
Message 8 of 8

ondrej.mikulec
Advocate
Advocate
Accepted solution

Then the issue could be with the user inputs. The macro actually works on my computer. I am able to simulate your issue only when I close the input dialogs without inputting any values or instead of numbers inputting some other chars.

0 Likes