Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

macro error with adding REALs together...

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
jsweatherbie
384 Views, 7 Replies

macro error with adding REALs together...

//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 ? 

7 REPLIES 7
Message 2 of 8

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}
Message 3 of 8
jsweatherbie
in reply to: jsweatherbie

jsweatherbie_0-1713563996739.png

 

Message 4 of 8

didnt work still errored
Message 5 of 8

double check the $ at the yAxis

Message 6 of 8

i did and nothing changed . same error and i made sure it was "${$yAxis - $blockOffset}"
Message 7 of 8
jsweatherbie
in reply to: jsweatherbie

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
Message 8 of 8

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report