Sunday 18 August 2019

Fusion 360 post processor - create a post processor for Centroid with probing??

WTF?
This must the the definitive rabbit hole. I've been aiming to attempt a modification to the existing post processor that is provided for use with the Centroid controller. Fusion 360 now implements a fairly comprehensive range of workpiece probing functions for use within a machining operation. The issue is that the existing Centroid post processor doesn't incorporate the required content to handle those features. Most of the main, generic posts have (by definition) a large user base, so one way or another, the effort has been applied to create the required modifications. Centroid on the other hand is more of a minority sport and as far as I can tell, there are no plans afoot to do the required work.

I never expected it to be a simple matter but the more I get into it, the more convoluted the challenge reveals itself to be. Hence the Lewis Carol reference.

The scope:
Here's how I saw the task, around 2 weeks ago, as posted on the Centroid forum:

This may be naive on my part but I'm looking at the possibility of creating a modified post processor to enable Fusion 360 probing. There are several Fanuc-based posts available that support Fusion probing and I have been digging in to the details to understand what I'd need to do to create a Centroid equivalent. Looks to me as if there are several elements to it:

* Replace the basic probe move macros (G38.2, G38.3 etc) with equivalent Centroid macros. Can I simply use M115 and/or M116? Can I access / edit M115 / M116 if they aren't quite right?
* Modify the higher level Fusion probe macros (slot, boss, corner etc) that call them. That sounds less challenging unless I misunderstand. I have been given Fusion-Fanuc versions that implement the required functions.
* Re-reference any called system variables from the Fanuc numbering to the Centroid numbering
* Copy over / modify the post processor probing content into the Centroid post to create a "Centroid with Fusion probing" post.

From my current position (of massive naivety?) it's looking almost achievable. One critical element though is replacing the Fanuc system variables with the equivalent(?) Centroid ones, so they can be called. In Fanuc Custom B, the variables are typically in the 5000 range. From the list of variables in the Centroid probing folder, I see a section at the top named "return values and modals". This looks promising. Could somebody help to confirm / clarify for me what they mean? My questions are in {brackets}.

#34000 ; Probing feedrate {this seems fairly obvious}
#34001 ; Clearing feedrate {is this the retract rate back to the clearance height?}
#34002 ; PLC bits start ;50001 for cnc11 6001 for cnc10 {so Acorn starts at 50001?}
#34003 ; Probe PLC bit variable {indicates the PLC probe input and whether it's NC or NO??}
#34004 ; Probe PLC bit tripped state {the probe input state?}
#34005 ; M115/116 probe input number {eg 7 for INP7? - not sure how M115 differs from the PLC input}
#34006 ; Last X probe point ; also single axis probe return values {at the moment of tripping}
#34007 ; Last Y probe point ; also single axis probe return values
#34008 ; Last Z probe point ; also single axis probe return values
#34009 ; Probe diameter {presumably this is read from the tool table in CNC12?}
#34011 ; comparison tolerance {what is this for?}
#34012 ; Last boundary crossed value (M227) {I can't see any reference to M227 in the manual)

Am I on the right track? Are Centroid about to release a Fusion probing post? Is there any obvious roadblock I'm not seeing?


Finally, are the values for feed and distance in the default metric / imperial units? Questions, questions...

So I started out by printing out the various macros and post processors that seemed to be most relevant to the case i hand:
  • Fanuc generic post (which incorporates probing functions)
  • Tormach / PathPilot (LinuxCNC) post (ditto)
  • Centroid latest post (as discussed, no probing functions at all)
Given that Centroid have recommended the use of Notepad++ for some time now (and continue to do so) - and Autodesk initially recommended it too, I started out using it to edit, print and notate these puzzles. It's certainly better than a std, simple text editor such as Notepad but doesn't come close to the more modern alternatives such as Brackets or (more compellingly) Microsoft's Visual Studio Code, which is both free and available with Fusion-specific support for the Javascript code that the Fusion post is written in.

Post editing options - Visual Studio Code:
The required post processor editing stuff is linked to in the Autodesk HSM website, including the Fusion-specific extension. The easiest way to install the extension (in my view) is via the VSC environment itself, by searching in the extensions marketplace for "HSM" and grabbing the post editor extension from there. On my workshop PC I found I had to go into extensions and enable some of the options for running the loaded post when an intermediate file is loaded.

There's some VSC-related guff here too. For Javascript-specific info, there's a VSC page here.

If you prefer a video overview of VSC and its use here, this is the link.

The vital resource for anyone believing they are about to attempt edits to a post processor is the 180 page Post Processor Training Guide from the HSM team

Editing posts with VSC and the HSM extension:
Once you have set up the JS extension provided by Autodesk, you need to install a dedicated post processor that supports VSC. This generates an "intermediate" file (with a ".CNC" extension) that can be used by the JS editor. 


In VSC, this file appears in the left hand column in the "CNC SELECTOR" panel under the "CUSTOM" area. Alternatively, there is a range of standard intermediate files preloaded there which can be used to test out post processor edits. Along with the active post processor (shown in the middle panel), you can generate g-code output in the right panel (press Ctl-Alt-G). 

This is where things start to get really horny. If you select a line in the g-code, the editor will highlight the line in the post that generated it.


This is a lot smarter than Notepad++. However, there's simply no avoiding the need to digest the Post Processor Training Guide, all 180 pages of it. That'll shut me up for a while. It's almost enough to drive me to working on the bathroom again....

No comments:

Post a Comment

Final assembly and test of the spindle nose adaptor - RESULT!!

After the recent distraction caused by the 3D scanner, resurrecting the 3D printer and buggering about with the throttle bodies for my Honda...