custom Postprocessor function for STOP on Datron machines

custom Postprocessor function for STOP on Datron machines

infoXNDBJ
Contributor Contributor
148 Views
8 Replies
Message 1 of 9

custom Postprocessor function for STOP on Datron machines

infoXNDBJ
Contributor
Contributor

Hi guys,

 

we need a custom M00 stop-like on Datron machine.

 

Datron machines are programmed with macros/sub-macros, and it is not that easy as with ISO-based machines.

 

I managed to get code into programm, but it is everywhere...not where it is needed with DirectNC code/M00 stop.

 

The main issue is a check if "directNC" code exists, and only then post the custom code.

 

We need something like. If directNC command M00 is in program do something.

 

if DirectNC.Command_STOP == 1 {
  onCommand(COMMAND_STOP)
}

 

 

 

I have asked Autodesk support, and they replied the standard excuse "contact your Autodesk partner for customisation." Of course, we asked these partner guys, and they have no idea. It is just sellers, not machinists. There is no reference manuals for system parameters.

 

In JavaScript I can easily get name of object/process. How one interacts with Fusion processes, please?

 

Let's say I wanna get name of process, how one can do it, please?

 

Any suggestions, please?

 

Regards

 

David

0 Likes
Accepted solutions (1)
149 Views
8 Replies
Replies (8)
Message 2 of 9

BobVawter
Enthusiast
Enthusiast

> The main issue is a check if "directNC" code exists, and only then post the custom code.

 

You might be able to do this with a custom post- or operation-level boolean property.  It's unclear from your message which post you're using, I'm assuming this one: https://cam.autodesk.com/posts/post.php?name=datron%20next

 

If you look at line 38, there's a `properties` block where you can define the various options presented to you when setting up an NC program.  To pick one at random:

 

 useSmoothing: {
    title      : "Use smoothing",
    description: "Specifies that smoothing mode should be used.",
    group      : "preferences",
    type       : "boolean",
    value      : true,
    scope      : "post"
  },

 

You can duplicate this as useCustomM0 to enable your custom M0 behavior on a program-wide basis.  You can also change where is says scope: "post" to scope: [ "post", "operation" ] to allow the property to be defined on a per-toolpath basis.  It will show up as another tab in the operation details UI.

 

Screenshot 2025-08-18 at 09.23.27.png

 

You can make use of custom properties with something like if (getProperty(properties.useCustomM0, false)) { ...}

 

If the custom behavior is something that you want to add in a manner similar to a manual NC command, you can also define custom actions for the post processor.  Custom actions are good when you want to communicate between the Fusion operation list and the internal state of the postprocessor, For example, I have custom actions to enable and disable the use of rotary brake commands in programs that frequently reposition between light 3+2 operations.  To do this, you'll update onManualNC.

 

var inhibitLock = false;
function onManualNC(command, value) {
  switch (command) {
  case COMMAND_ACTION:
    if (String(value).toUpperCase() == "INHIBITLOCK") {
      inhibitLock = true;
    } else if (String(value).toUpperCase() == "ALLOWLOCK") {
      inhibitLock = false;
    }
}

 

In the UI, you'll use Manual NC of type Action with whatever string(s) you want to pass into the postprocessor.

 

Screenshot 2025-08-18 at 09.22.16.png

0 Likes
Message 3 of 9

infoXNDBJ
Contributor
Contributor

hi Bob, thanks for reply. We do have old Inventor-era custom postprocessor created by some Autodesk partner. It is half-baked master work that I have partially edited. It works 99% of time...Boss have no interest to change to new postprocessor 🐵

 

   useDatronM0: {
    title      : "Datron STOP",
    description: "wie ISO M00",
    group      : "preferences",
    type       : "boolean",
    value      : true,
    scope      : [ "post", "operation" ]
  },

As suggested, I have written user property.

 

function onSectionEnd() {
....
  if (getProperty(properties.useDatronM0, true)) {
    writeBlock("Submakro Retractzmax;");
    writeBlock("$Message = \"Gewinde Ausblassen\";");
    writeBlock(translate("Message") + " $Message, 2, 0, 0;");
  }
...}

 

Each process has got a new tab

Screenshot 2025-08-19 123028.png

 

Exported program still has got at end of each submacro above by M00, no matter whether the checkbox is on or off. It makes me wonder where is a problem???

 

If I understood Autodesk training guide, checkbox on = true, and vice versa. It should export above by commands only if checkbox is on, no?

 

 

0 Likes
Message 4 of 9

infoXNDBJ
Contributor
Contributor

little correction because it was used globally

 

  useDatronM0: {
    title      : "Datron STOP",
    description: "wie ISO M00",
    group      : "preferences",
    type       : "boolean",
    value      : false,
    scope      : "operation"
  },

 now, it should be allowed only per process basis.

 

Still, postprocessor exports at each section end/sub-macro end "M00 code". Boolean check seems to not work 🤔

0 Likes
Message 5 of 9

BobVawter
Enthusiast
Enthusiast
if (getProperty(properties.useDatronM0, true)) {

The second parameter is a default value to return when the property not not been defined for a program or section.  In this case you want it to be false.

0 Likes
Message 6 of 9

infoXNDBJ
Contributor
Contributor

false = nothing is exported by postprocessor

true = every process gets M00

I have also tried

(getProperty("useDatronM0") == true)

 it keeps either post all or nothing 🤔

 

if (getProperty("useDatronM0"))

In Python, most likely also JavaScript (Autodesk Fusion uses JS) this means "if true". There is something wrong with conditional check

0 Likes
Message 7 of 9

BobVawter
Enthusiast
Enthusiast
Accepted solution

What you've written looks exactly right to me.  What does the post set the minimumRevision value to?  If it's an old, old post I wonder if there's perhaps some API backwards-compatibility being applied?  FWIW, the value in my base post is minimumRevision = 45917.

 

There's an alternate currentSection.getProperty() form, per https://cam.autodesk.com/posts/reference/classPostProcessor.html#a8f6be90781835876e83f3f9c3a2a9f2e but I've never had to use that.  Maybe currentSection.getProperty("useDatronM0") instead?

Message 8 of 9

infoXNDBJ
Contributor
Contributor

I had 

minimumRevision = 41215;

now it works. Thanks Bob 

Message 9 of 9

infoXNDBJ
Contributor
Contributor

few days later, Postprocessor exports again M00 everywhere 🤔 No changes were made, there is something wrong with true/false test.

0 Likes