April 16, 2024

Creating a tool list in your NC Code file with SmartCAM.

With SmartCAM, can create a tool list at the top of your G-code file that might look like this:

O0123
(Tool 1: 6.0000 Dia. / 0.0300 Rad. 10 Flute Face Mill - )
(Tool 2: 0.5000 Dia. x 90.0 Deg. 2 Flute Spot Drill - )
(Tool 3: 0.3125 Dia. 2 Flute Twist Drill - 5/16)
(Tool 4: 1.0000 Dia. 5 Flute End Mill - )
N1 T1 M06
G54 G00 X4.8717 Y0.0 

The details and an "Example" that you can copy and paste into your own CGT can be found in the Learning SmartCAM Code Generator Guide here:
https://www.smartcamcnc.com/LearnSmartCAM/current/Default.htm#chap7_codegen/template_word_ref.htm#St

How it works:

First, declare the variables you'll need to hold and output the step and tool information. For example:

@DECLARE
#INT #tl_num // this will hold the tool number
#STR #tl_desc // this will hold the tool description

Then create a user tool list section. For example:

@tlist
#EVAL(#STEP_LIST_SLCT = 2)
#EVAL(#STEP_LIST_SORT = 2)
//
#STEP_LIST()
<
#EVAL(#tl_num=jos(tl_num))
#EVAL(#tl_desc=jos_str(tl_desc))
(Tool #tl_num: #tl_desc)
>
@

This section sets up how the list will be output. #STEP_LIST_SLCT = x determines what to output. #STEP_LIST_SORT = x determines how to output it. (see the Learning SmartCAM topic, above, for these details).

The #STEP_LIST() is a looping command, much like the #REPEAT command. It's only function, however, is to find each step in the model.

Usually at the top of the @START section you can add a call to the @tlist section:

@START
O#PROGID
#CALL(tlist)

While looping in the #STEP_LIST() loop, the commands within the <> brackets are executed. It reads the first jos(tl_num) and jos_str(tdesc), then outputs them on the same line, as illustrated above. And loops until all steps have been encountered.

Again, this can all be copied and pasted from the "Example" from the Learning SmartCAM topic.  

No comments:

Post a Comment