Author Topic: Post Processor and Tool Table, specifically {$tool.index} and {$tool.diameter}  (Read 364 times)

Offline OTJtraining...Again

  • Ewok
  • *
  • Posts: 24
    • View Profile
I've worked my way around Post Processors a modest amount, enough that I have a post processor for different machines and even different purposes. The piece that I continue to struggle with is getting the {$tool.index} and {$tool.diameter} macros to populate in the header so that Cutmill Viewer will get the correct details without manual intervention. Here is my Header File:

Code: [Select]
{$comment} CamBam File: {$cbfile.name} {$date} {$endcomment}
{$comment} CUTVIEWER {$endcomment}
{$comment} T{$tool.index} : {$tool.diameter} {$endcomment}
{$comment} FROM/0,0,5 {$endcomment}
{$comment} TOOL/MILL,{$tool.diameter},{$tool.radius},{$tool.length},0 {$endcomment}
{$comment} STOCK/BLOCK,{$stock_width},{$stock_length},{$stock_height},{$stock_x},{$stock_y},{$stock_z} {$endcomment}
{$cbfile.header}
{$units} {$distancemode} {$arccentermode} {$velocitymode} {$cuttercomp(off)}

And this is an example of what I get afterward in the NC Output: (Yes, the stock is not at the machine origin, this is intended.)
Quote
( Made using CamBam - http://www.cambam.co.uk )
( CamBam File: 6040CNC_Open-Space_Heater-Plates 2/29/2024 3:51:53 PM )
( CUTVIEWER )
( T :  )  <------------------ ???
( FROM/0,0,5 )
( TOOL/MILL,,,,0 )  <------------------ ???
( STOCK/BLOCK,306.38,50.8,12.7,-11.9,195.4,-3.0 )
G21 G90 G91.1 G64 G40

Within CamBam all of the 'tool paths' and 'cut widths' appear correctly, and as they do when I'm executing code on a CNC.

What am I missing? Thanks!
« Last Edit: March 01, 2024, 00:07:49 am by OTJtraining...Again »

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1947
    • View Profile
    • pixelmaker
Note: The $tool.diameter macro will not be defined until there has been a tool change command.
If used in the header section, use a tool change such as $toolchange(first) before referring to $tool.diameter.

Offline OTJtraining...Again

  • Ewok
  • *
  • Posts: 24
    • View Profile
Thank you pixelmaker! For others that want to see the before and after, here is what that Post Processor now looks like:

Code: [Select]
{$comment} CamBam File: {$cbfile.name} {$date} {$endcomment}
{$toolchange(first)}
{$comment} CUTVIEWER {$endcomment}
{$comment} T{$tool.index} : {$tool.diameter} {$endcomment}
{$comment} FROM/0,0,5 {$endcomment}
{$comment} TOOL/MILL,{$tool.diameter},{$tool.radius},{$tool.length},0 {$endcomment}
{$comment} STOCK/BLOCK,{$stock_width},{$stock_length},{$stock_height},{$stock_x},{$stock_y},{$stock_z} {$endcomment}
{$cbfile.header}
{$units} {$distancemode} {$arccentermode} {$velocitymode} {$cuttercomp(off)}

And it successfully populates the details for Cutmill Viewer. There are some other details added as well... but its a lot easier to remove than add!

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7333
    • View Profile
    • Cambam V1.0 French Doc
Hello

In the stock Mach3-cutviewer PP installed with Cambam, Andy use a dummy definition to avoid cutviewer complain.

{$comment} {$cbfile.name} {$date} {$endcomment}
{$comment} Post processor: Mach3-CutViewer {$endcomment}
{$tooltable}
{$comment} CUTVIEWER {$endcomment}
{$comment} FROM/0,0,100 {$endcomment}
{$comment} Select dummy tool to avoid warnings {$endcomment}
{$comment} TOOL/MILL,1,0,20.0,0 {$endcomment}
{$comment} STOCK/BLOCK,{$stock_width},{$stock_length},{$stock_height},{$stock_x},{$stock_y},{$stock_z} {$endcomment}
{$cbfile.header}
{$units} {$distancemode} {$velocitymode} {$cuttercomp(off)}
{$arccentermode}
{$toolchange(first)}
{$clearance}


Also have a look on this post, it explain how to manage tool profiles that are not supported by CamBam (by coding them directly in the tool definitions)

https://cambamcnc.com/forum/index.php?topic=5409.msg43026#msg43026

++
David
« Last Edit: March 01, 2024, 20:23:55 pm by dh42 »