access operational properties in postprocessor

access operational properties in postprocessor

infoXNDBJ
Contributor Contributor
208 Views
12 Replies
Message 1 of 13

access operational properties in postprocessor

infoXNDBJ
Contributor
Contributor

We need a STOP on Datron machine. A custom operational property is added:

 

properties = {
  ....
  Datron_STOP: {
    title      : "Datron STOP",
    description: "wie ISO M00",
    group      : "preferences",
    type       : "boolean",
    value      : false,
    scope      : "operation"
  }
};

Each process has got a new table:

Screenshot 2025-08-19 123028.png 

 

In postprocess is defined where to add the code if STOP box is checked:

function onSectionEnd() {
  ....
  if (getProperty(properties.Datron_STOP)) {
    onCommand(COMMAND_STOP);
  }

According to Fusion postprocessor guide "5.1.6 Accessing Properties". Above by code should check if condition is met. Unfortunatelly, it doesn't work. I can access global property if defined, but it exports STOP code in every process.

Any suggestion how to access operational properties of process, please?

0 Likes
Accepted solutions (2)
209 Views
12 Replies
Replies (12)
Message 2 of 13

AchimN
Community Manager
Community Manager

Try this pls:

  if (getProperty("Datron_STOP")) {
    onCommand(COMMAND_STOP);
  }

 



Achim.N
Principal Technology Consultant
0 Likes
Message 3 of 13

infoXNDBJ
Contributor
Contributor

I have also tried recommended string access. Neither works.

 

Also tried

if (section.getProperty("Datron_STOP")) {
0 Likes
Message 4 of 13

viacheslav.shapilov
Autodesk
Autodesk

@AchimN Both methods should work in the same way.

@infoXNDBJ I just copied your code into dumper to see, what it outputs, and it works correctly. If checkbox is selected, I am getting "true" in the post, if unselected - "false".

What I noticed on your screenshot there is an additional checkbox. We show it for mixed scope properties for example ["operation", "post"]. In this case, if first check box is not selected, we will use property value from NC program. Could you please send us the post and test file, if it is not the case. May be there is a bug, we don't know.


Viacheslav Shapilov
Developer Technical Services
Autodesk Developer Network


0 Likes
Message 5 of 13

infoXNDBJ
Contributor
Contributor

Attached our Datron postprocessor. It is old InventorCAM era customised for our machine. It is possible it doesn't work in Fusion as suppose to. Except STOP, it works 99% of time, so there was no pressure to migrate for new postprocessor.

It is old screenshot where was mixed properties as you have written. I have now only one checkbox.

 

Attached Program, Operation "Fase D8 1x45° mit STOP" where we need a stop for blowing out swarfs from hole before Thread mill does threads.

0 Likes
Message 6 of 13

viacheslav.shapilov
Autodesk
Autodesk
Accepted solution

I see, what is the issue.

This post is too old, and it uses two separate object: properties and propertyDefinitions. New function getProperty correctly works only with merged properties object like in new posts. Probably, we should not show them in UI to make it more obvious. You need to migrate this post to new properties format:

- rename "propertiesDefinition" to "properties",

- move values from "properties" to definitions "value" fields,

- remove old properties object,

- replace all accessors from "properties.someProp" to use "getProperty(...)" function.

 

Alternatively, you can use currentSection.properties directly:

if (currentSection.properties["Datron_STOP"]) {
//or
if (currentSection.properties.Datron_STOP) {

Surprisingly, it works in your post correctly. But it can be broken in future, as it is not officially supported. So, if you are going to use this post for a long time, do properties migration.


Viacheslav Shapilov
Developer Technical Services
Autodesk Developer Network


0 Likes
Message 7 of 13

AchimN
Community Manager
Community Manager

@infoXNDBJ
If you are using our Visual Studio Code extension to edit your posts, you will find that it includes a function that makes updating your existing posts with the new property definitions very easy:

AchimN_0-1755869725294.png

I did that for you already using this tool, post attached.

Note that since your post is quite old, you may want to switch to the latest one we have on our library.



Achim.N
Principal Technology Consultant
Message 8 of 13

infoXNDBJ
Contributor
Contributor

thanks, postprocessor properties modernized. It seems to be working now, at least in computer 🐵

 

What still doesn't work is onManualNC(COMMAND_STOP)

 

Above by solution is per operation. We often use "folders>patterns". With above by solution it will stop by every part.

 

 ManualNC>Stop is better solution where it stops after all operations on all parts in pattern are done.

 

DirectNC commands are ignored by function writeMainProgram() - it simply spits the stop code, and machine fails to load program because it is not defined as sub-macro, and there is no call in main program.

 

...
Axyz 0, -352.83254, 231.98473, 0.25, 0, 0;
Axyz 0, -352.8501, 231.94858, 0.4, 0, 0;
Axyz 1, -352.8501, 231.94858, 30.08, 0, 0;
Submakro DatronStop;                          <---- CORRECT STOP
) Sm_fased81x45mitstop__1;
Submakro DatronStop;                          <---- WRONG PLACE
....
; !##########Fase D8 1x45? mit STOP __1##########!
Markierung 1;
; ! ZMIN = 0.1!
Werkzeug T19, 0, 0, 1, 0;
Drehzahl 3, 35, 0, 30;
Dynamik 3;
Entry = 5;!m/min!
Exit = 5;!m/min!
Reduziert = 2;!m/min!
Eintauchen = 18.5;!m/min!
Position 2, 2;
Submakro Sm_fased81x45mitstop__1;
                                    <---------- ManualNC code SHOULD be there
; !###############################################!
Submakro Retractzmax;
Park;

 

Any suggestions, please?

0 Likes
Message 9 of 13

infoXNDBJ
Contributor
Contributor

What I understand there were some issues with probing, and setting reference point. Some issues with angles during probing WCS - "Angle along X/Y axis", it turned the virtual C axis in wrong direction. I have no idea, I just changed what make my work simpler.

 

Since it works in 99% of cases, boss doesn't want to reinvent wheel. It may work, or not...nobody knows. We have no time to test it. I made few changes, but fundamentals of postprocessor remain same for at least 7 years.

0 Likes
Message 10 of 13

AchimN
Community Manager
Community Manager

The Datron post has a special structure compared to the other generic posts as it does output the main program in onClose.
You must add your stop command into the writeMainProgram function right after the subprogram call line, not in onSectionEnd.
Code to be used:

if (section.getProperty("Datron_STOP")) {
  onCommand(COMMAND_STOP);
}

 



Achim.N
Principal Technology Consultant
0 Likes
Message 11 of 13

infoXNDBJ
Contributor
Contributor

already tried. writeMainProgram suppose to loop all operations, and export the main program section. DirectNC command is ignored for some unknown reason. I have compared the new generic postprocessor with our modernized version, and I can't find any difference. Of course, it is written completelly different.

 

DirectNcOperation is commented out in Autodesk Datron postprocessor. In our PP there is:

var manualNC = [];
function onManualNC(command, value) {
  var section = typeof currentSection == "undefined" ? getSection(0) : currentSection;
  manualNC.push({command:command, value:value, sectionID:section.getId()});

We have only with my test:

function onCommand(command) {
  switch (command) {
...
  case COMMAND_STOP:
    writeBlock(translate("Submacro") + " DatronStop;");
    return;
...
  }

I tried to copy what is in Autodesk Datron PP, and it ends up with error because there are more functions what we do not have. It uses function SimPLProgram for example.

 

Unfortunatelly, with custom modification to our old PP it is not possible to simply take the new generic PP. There are many modifications that are missing in generic PP.

 

 

 

0 Likes
Message 12 of 13

AchimN
Community Manager
Community Manager

I´m afraid you are mixing up multiple things here. The post you are using is the Datron MCR post which is made for the older control version. There is another one called "Datron next" which is made for the new Datron control, and only that post for the new control does contain code like SimPLProgram.

You may want to reach out to one of our partners who offer post customization: https://www.autodesk.com/support/partners?services=Post%20Processor



Achim.N
Principal Technology Consultant
0 Likes
Message 13 of 13

infoXNDBJ
Contributor
Contributor
Accepted solution

I have tried Autodesk Generic Datron MCR PP with STOP. It seems to work, except if only DirectNC is exported...it fails because DirectNC/manualNC is not considered as section/operation of program. Of course, one never exports only DirectNC on Datron. Question is whether PP will work in Machine. thanks guys

 

Warning: Program does not contain any sections.
Generiert von: Fusion CAM 2603.1.52
...

###############################################################################
Fehler: section is null
Error at line: 855 (datron mcr.cps)
Failed while processing onCommand() for record 44.

 

0 Likes