Support Links

Technical Bulletins

Customer Downloads

Code Generators

SmartCAM Email Forum

Patches and Utilities

Misc Resources

The Learning SmartCAM Tutorial

SmartCAM V11 Exploring Guides

Contacts


Maintenance Customer
Premium Content

SmartCAMcnc Technical Support

Topic: Passing variables to the Code Generator

Technote 209 Date: May 2005 Product: All SmartCAM Applications  Version: All

Problem:
How do I use variables defined in the application in the Code Generator?

Solution:
Pre-allocated words, or system variables are passed automatically. See page 195 of your Code Generator Guide for information about Pre-allocated User Words.

The value of a macro user variable can be retrieved from within the Code Generator through the system calculator. In any sort of equation, if the Code Generator can't find a macro variable within its own variable set, it invokes the system calculator which tries to find it elsewhere. The primary function in the Code Generator where this happens is the #EVAL() statement.

For example:

@DECLARE
#INT #codeType

@START
#EVAL(#codeType=#yourVariableHere)

Then you can use #codeType inside the Code Generator wherever you need to.

Be aware not to name your Code Generator variable the same as your macro user variable because then the Code Generator will find the Code Generator variable first and never invoke the calculator to look in the macro system.

Generally variables are used in a macro, but can also be accessed from other places. They can reside in the JOS subsystem with Data Tags (see page 175 of the Customization Guide), User Commands can contain them (see User Event in Help), and they can be entered directly.

You can enter variables or expressions in most input fields of the SmartCAM interface. Variable names '#myVar', JOS Data Tags 'JOS(tl_dia)', and Snap Commands 'STX(#el)' are all acceptable inputs. When recording a macro, the variable name or expression is recorded, not the value. This is useful for creating similar parts with variable dimensions for example.