Fundamentals: JOS Information and KBM Library

The JOS_STR() and JOS() functions lets you obtain the expression string representing the value of a data tag. Both functions are available from the Macro Command Language and Code Generators. Both require a single argument representing the tag name of a JOS variable.

In the following table, each JOS data tag has an expression and a numeric value determined by evaluating the expression. Expressions representing strings such as tl_desc are not evaluated.

JOS Data Tag Expression Value
tl_dia "0.5" 0.5
tl_len "3*jos(tl_dia)" 1.5
tl_desc "1/2 inch End Mill" "1/2 inch End Mill"

The JOS() function returns the numeric value determined by evaluating the expression associated with the given tag name. The JOS_STR() function returns the string expression associated with the given tag name.

For both functions, the expression associated with the specified tag name is determined by the current context in the Job Operations Planner. The current context is defined by the global job information and the current step. In the macro language, the JOS context is specified by special functions for opening, editing, and closing JOS context.

These JOS() functions may not return a value or string expression for the following reasons:

See the following complete list of Job Operation Setup data tags.

Sample Macro File Using JOS_STR()

// Temporary string variable
STRING:#DESC
JOS_CONTEXT_OPEN[BASEITEM=1, USERNAME="1"]
#DESC=JOS_STR(tm_notes)
PAUSE[TX=#DESC, PT=0]
JOS_CONTEXT_CLOSE[]

The macro first declares a user string variable called #DESC and establishes the JOS context (tool #1). The string expression for tool notes is assigned to the user variable. The PAUSE command opens a message box displaying the contents of the #DESC user variable verifying that the assignment was successful. Finally, the macro closes the JOS context. The JOS context is the current step being processed by the macro.

Using the KBM Library

The following information briefly covers how to pull Tool and Step data from your KBM tool library into your active job.

Load Step or Tool Group

To load an entire Step or Tool group into your active job, you use the KBM_SGROUP_LOAD[] and KBM_TGROUP_LOAD[] macro commands. With these macro commands, you provide the ID number of the Tool or Step group that you want to import. You also set whether to automatically assign tool and step numbers, when importing, or whether to use tool/step numbers from the Tool or Step group. If there is a number conflict, SmartCAM will assign a new number.

To find the Tool or Step Group ID, use Process - KBM Library - Manage Library. The ID values are displayed next to the Group name on the Tool Group and Step Group tabs.

Unlike the macro commands for importing a single step or tool, you do not need to establish a proper JOS Context to use the two Group macro commands. You do need to make sure you import the information before you try to use it.

Importing a Step Group will also import the tools references by the Steps. Importing a Tool Group will just import the tools.

Here is an example. In this example, the user's KBM library database has already been updated and includes a "EndMills" tool group and a "RoughMilling" Step group. The Tool and Step group names should make sense to you, these two names are just for purposes of this example. The ID values, for this example, are 4 for EndMills and 11 for RoughMilling.

// Import the Tool Group EndMills, allowing SmartCAM to assign the tool numbers
KBM_TGROUP_LOAD[OBJUID=4, USE=0]
//
// Now, import the RoughMilling Step Group and use the Step/Tool numbers saved in the group
KBM_SGROUP_LOAD[OBJUID=11, USE=1]

Load Specific Tool or Step

Loading a specific Step or Tool into the active job is a bit more complex than loading an entire Step or Tool Group. When working with individual Step and Tools, you need to work within a properly configured JOS Context.

The JOS Context, while not particularly complex, does have to handled in just the right way. As such, SmartCAMcnc recommends that if you want to import individual tools or steps/tools you should record a macro fragment, using the SmartCAM UI. Then merge the recorded macro commands into your working macro. Then edit the imported statements as needed.

When using the Step import macro command, it will also import the Step's associated tool.

When working with these macros, remember that not only do you need to establish a new JOS Context, you also need to create a new Tool item - for the KBM library tool information to be stored. The KBM database import should happen after you establish the context and new tool. But before you try to make any modifications to the JOS data for either the imported Step or Tool.

Also keep in mind, that if you are pulling the Step or Tool from a KBM named Group, you refer to the Group and Step or Tool #. But if you are not referencing a KBM Group, you refer to the Tool or Step ID (different from #) directly. You should use Process - KBM Library - Manage Library to review the information before trying to hand write a macro.

The GRPUID parameter is expecting the ID number for the named group you which to load from. You can find the named group ID in Process - KBM Library - Manage Library. The ID values are displayed next to the group names on the Tool Group and Step Group tabs.

The following gives you an idea of how this might work.

// Import Step, using Step ID 11 (Step # 20)
//	Create the JOS Context
JOS_CONTEXT_NEW[BASEITEM=1, NEWSNCS=1030101] // new Rough Milling Step
//	Now establish the new tool
JOS_ITEM_NEW[BASEITEM=2, NEWSNCS=2410101] // new End Mill
//	Now import Step 20, which uses Step ID 11
KBM_STEP_DATA_LOAD[GRPUID=0, SNUM=0, OBJUID=11]
//	Update the tool number and user name JOS data tags
JOS_FIELD_EDIT[FLDNAME="tl_num", EXPR="1"]
JOS_FIELD_EDIT[FLDNAME="ta_usrname", EXPR="1"]
//	Update the JOS data
JOS_CHANGES_PROMOTE[]
//	Close the JOS context
JOS_CONTEXT_CLOSE[]

Related Topics

Expressions

Variables

Macro Development Fundamentals Overview

SmartCAM Automation Overview