Go Back to handibot.com
sign up or log-in


Programming with variables

Posted by NorthwayInd 
Programming with variables
March 05, 2018 03:11PM
I am trying to add some variables to my program. When I run the program it crashes on the first variable that it comes to. Anyone have any experience with variables that could give some advice?
Re: Programming with variables
March 08, 2018 04:13PM
Hey, sorry I took so long to respond!

What kind of function are you trying to achieve with your program?

There are two ways to create variables &variables and $variables.
&variables (i.e. &xoffset = ) are temporary variables, they'll only be stored for the duration of the cut file and will be erased at the end. Use these for storing info in a file...like if you want to store the current X location before a move and then return to that location later--or if you want to store your initial settings for something like "maximum jerk" before temporarily changing it (like we do in the homing routine)

$variables (i.e. $zzeroheight = ) are persistent variables that will continue to exist even after I file is complete. Use these for values that you will use in many programs--like the offset for a z-zeroing plate.

There are two operators that can assign a value to a variables "=" and ":=" ... "colon-equal" ( := ) will assign the value to the variable only if there is not already a value assigned. This is helpful for things that users might assign their own values to and you only want to push your value to the variable if they forgot to assign one themselves. This is what we do for the Z Zero Plate height--assign a value of 0.75" unless the user has already assigned some different value of their choice.

Are you getting any message along with the error you're seeing?
Sorry, only registered users may post in this forum.