How to include G10 Tool Length in Haas Post Processor

How to include G10 Tool Length in Haas Post Processor

kentdesautel
Enthusiast Enthusiast
1,089 Views
9 Replies
Message 1 of 10

How to include G10 Tool Length in Haas Post Processor

kentdesautel
Enthusiast
Enthusiast

Currently hand enter my tool length at my Haas CNC ( Pre Next Gen Control )

I would like to use Fusion 360 to manage my tool length data and have my post processor include this in my G-code so that it automatically gets loaded into my machine.

 

I don't have an auto tool setter on my machine, so when ever I install a new tool in the machine I would get my exact tool length measurement and key that into Fusion.

 

So my hopes would be that this length would get loaded onto the machine offset page when I load my program.

 

Is this possible?

 

I've attached my post processor to this message.

 

Thank You,

 

Kent

0 Likes
Accepted solutions (1)
1,090 Views
9 Replies
Replies (9)
Message 2 of 10

kentdesautel
Enthusiast
Enthusiast

Just a follow up comment on my original post...

I have figured out how to manually add my G10 code ( Example my tool #5 with a length entry of -8.50 )

G10 L10 G90 P5 R-8.50

 

So now I just need to know the edits to my post to automatically create my G10 lines of code to create the Tool# and Length.

 

I am planning to use the " Overall Length " Field from the Cutter Tab in the tool library for managing my master list of tool lengths...   ( unless there is a better option? )

 

 

0 Likes
Message 3 of 10

will_1
Alumni
Alumni

Hi @kentdesautel ,

 

Adding something along the lines of this code to onOpen should give you what you want.

 

  var overallLengths = {};
  var numberOfSections = getNumberOfSections();
  for (var i = 0i < numberOfSections; ++i) {
    var section = getSection(i);
    var tool = section.getTool();
    var overallLength = tool.bodyLength;
    // HSMWorks returns 0 in tool.bodyLength
    if (section.hasParameter("operation:tool_overallLength")) {
      overallLength = section.getParameter("operation:tool_overallLength");
    }
    
    if (!overallLengths[tool.number]) {
      overallLengths[tool.number] = overallLength;
    }
  }
  for (var i = 0i < tools.getNumberOfTools(); ++i) {
    var tool = tools.getTool(i);
    writeBlock(gFormat.format(10), "L10"gFormat.format(90), "P" + toolFormat.format(tool.number), "R" + xyzFormat.format(overallLengths[tool.number]));
  }
 
Let me know how it looks.
 
Thanks,
Will Watkins
0 Likes
Message 4 of 10

kentdesautel
Enthusiast
Enthusiast

Hello Will,

I might need a little assistance on where I should insert that code into into the OnOpen section.

 

On a side note, I'm wondering if I'm going to run into issues with the fact that in my tool list in Fusion the lengths are positive numbers, and in my CNC controller they are all Negatives?

 

Thanks,

Kent 

0 Likes
Message 5 of 10

will_1
Alumni
Alumni
Accepted solution

Hi @kentdesautel ,

 

I would put it right before this line of code.

 

  // absolute coordinates and feed per min
  writeBlock(gAbsIncModal.format(90), gFeedModeModal.format(94), gPlaneModal.format(17));

 

For the negative you can try multiplying the value by negative one...

"R" + xyzFormat.format(overallLengths[tool.number] * -1).

 

If this works for you, go ahead and accept as solution.

 

Thanks,

Will Watkins

 

 

0 Likes
Message 6 of 10

kentdesautel
Enthusiast
Enthusiast

Thanks Will....

That did the trick.

 

Thanks again...

 

Kent

 

0 Likes
Message 7 of 10

kentdesautel
Enthusiast
Enthusiast

Hi Will,

This change to the post processor has really worked well and saved me a ton of time.

I would like to take this one more stept and I'm wondering if I can talk you into giving me the code for the change.

 

I am planning to use a database program to manage my list of lool lengths, so my plan is to create a custom tool identity number for each tool and I would insert that into the COMMENT field in the Fusion 360 tool manager in the post processor tab.

So then I will just bump that up against my database to get the current tool length.

 

So long story short, could you help me with the code to pull that "Comment" data field and include with the post process.

 

( In other words I would like that "Comment" Field included in section )

N10 G10 L10 G90 P3 R-10.1852
N15 G10 L10 G90 P4 R-9.7534
N20 G10 L10 G90 P5 R-8.8875
N25 G10 L10 G90 P6 R-9.8144
N30 G10 L10 G90 P9 R-10.9093
N35 G10 L10 G90 P10 R-9.8565

 

Thank You!

Kent

0 Likes
Message 8 of 10

will_1
Alumni
Alumni

Hi @kentdesautel ,

 

I am not sure how you would want it to look, but...

 

I would add "formatComment(tool.comment)" to the end of the G10 writeblock line.

 

Let me know if that output looks right to you.

 

Thanks,

Will

0 Likes
Message 9 of 10

kentdesautel
Enthusiast
Enthusiast

Hi Will,

 

Yes, that did the trick.

 

A couple of follow up questions...

 

Question #1

I would also like to include the data from the "guid" field ( this appears to be the database field which assigns a unique id for each tool )

So with that in mind what would I need to add to my post to pull the data from the "guid"

 

Question #2

Where would I find a master list of all the available database fields from the tool database?

Currently I'm exporting my tool library into a .TSV file , but it looks like those database fields may be slightly different than what the post processor uses.

 

Thanks for your help on this Will....

 

Kent

0 Likes
Message 10 of 10

will_1
Alumni
Alumni

Hi @kentdesautel ,

 

You are probably going to find the "dump" post processor useful. This dumps all the parameters of an operation into a text file so you can see what maps to what.

 

https://cam.autodesk.com/hsmposts?p=dump

 

Let me know if that helps.

 

Thanks,

Will

0 Likes