Post processor add total number of work offsets used in the beginning of the program?

CuttingEdgeManufacturing
Collaborator
Collaborator

Post processor add total number of work offsets used in the beginning of the program?

CuttingEdgeManufacturing
Collaborator
Collaborator

how hard would this be to do? I use the Haas posts, and a milltronics post from autodesk. Basically want to spell out to setup guys how many offsets we are using in a program. I have it on my setup sheet already but as we all know things change very quickly in the manufacturing world, so i would like a final check in the program that says what the # of offsets its.

0 Likes
Reply
414 Views
7 Replies
Replies (7)

Garrett_Wade
Advocate
Advocate

While I don't disagree this could be nice, in the meantime you could try adding this info to the comment field when you post so it shows at the top of the program.

0 Likes

CuttingEdgeManufacturing
Collaborator
Collaborator
thanks for the input. I had not considered that. things change alot here. we have some jobs we repeat often, and each time we run them we just run however many offsets we can(based on vises in the machine) so i am always changing my programs..

will take this into consideration!
0 Likes

serge.quiblier
Autodesk
Autodesk

Hello @CuttingEdgeManufacturing 

 

It can be done in the post programmatically.

We need to browse the section available in the programs (i.e more or less the toolpaths), and list the wcs used.

To be smart, we need to add the wcs only once in our list.

Here is a small code doing this:

var wcsArray = new Array(); // dynamic empty array

function uniquelyAddToArray(arrayVar, arrayValue) {
  if (arrayVar.indexOf(arrayValue) < 0) { // if the value does not exist, add it
    arrayVar.push(arrayValue);
  }
}

function onOpen() {
  var wcsRead;

  var numberOfSections = getNumberOfSections();
  for (var i = 0; i < numberOfSections; ++i) {  // loop thru the section
    var section = getSection(i);
    var sectionWcs = section.wcs;  // extract the wcs number
    uniquelyAddToArray(wcsArray, sectionWcs);
  }
  var wcsNumber = wcsArray.length;  // get the size of the array = number of unique wcs used in the program

  writeln(wcsNumber);
}

You can grab the interesting part and throw them where ever you need.

 

Cheers.


______________________________________________________________

If my post answers your question, please click the "Accept Solution" button. This helps everyone find answers more quickly!

 

 



Serge.Q
Technical Consultant
cam.autodesk.com
0 Likes

CuttingEdgeManufacturing
Collaborator
Collaborator
can this be added in literally anywhere in the post? I'm familiar with C# which this is not from what I can tell. but it appears the functions can be placed anywhere I believe. looks like the onOpen() function would just run at runtime, so it shouldn't quite matter where it is placed?
0 Likes

serge.quiblier
Autodesk
Autodesk

Hi @CuttingEdgeManufacturing 

 

The variable definition for wcsArray should be placed in the global section, i.e for javascript anywhere between two functions bodies. This can be at the begining of the post when we are defining the format, variables...

It can be defined between two functions, before, or after the onOpen, javascript will find it as long at it's not inside another function body.

You can add it for example before the onOpen function.


Same consideration for the function uniquelyAddToArray.

 

And the code from var wcsRead; to var wcsNumber = wcsArray.length; can be added somewhere at the start of the onOpen function, eventually as in my example, at the very top of the function.

 

Cheers.

 


______________________________________________________________

If my post answers your question, please click the "Accept Solution" button. This helps everyone find answers more quickly!



Serge.Q
Technical Consultant
cam.autodesk.com
0 Likes

CuttingEdgeManufacturing
Collaborator
Collaborator

Well, it at least posted. I dont think its quite right just yet. but i have a good start.

 

It posted what i think to be the "WCS offset" textbox value in the 3rd setup tab. Ill need to do the number of instances i think instead. and wrap it in parantheses.

0 Likes

serge.quiblier
Autodesk
Autodesk

The array will contain the wcs index, but the variable wcsNumber will contain the number of wcs used in the program thru the differents sections.

It will be counting the number of differents values defined here

sergequiblier_0-1657204350163.png

 

Cheers.


______________________________________________________________

If my post answers your question, please click the "Accept Solution" button. This helps everyone find answers more quickly!



Serge.Q
Technical Consultant
cam.autodesk.com
0 Likes