Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Daisy chain posts...

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
DarthBane55
241 Views, 7 Replies

Daisy chain posts...

Hi, I might have asked for this previously, but I am not sure and can't find it...

I have a post that is already using a cascading post (for external simulator).

Is there a way to daisy chain posts (I don't think cascading is meant for what I am asking below)? 

The reason is that we now have 3 posts to run for each job, on a particular machine.  We output the normal NC program, then we output a Renishaw laser measuring program using another post, and then we now post a simple tool list for the machinist to keep track of tool pots and database tools for each machine (so he keeps track of which tool is in what pot easily when setting up jobs) using a 3rd post.

Is there a way to trigger the last 2 posts from within the main post?  It would save us some time as we need to post 3 times all the time.  Alternatively, is it possible to create 3 separate files within 1 post? (I would prefer the daisy chain method tho, to keep the posts cleaner).

Thanks!

7 REPLIES 7
Message 2 of 8

Hi @DarthBane55 

 

trying to run 3 posts in one posting is a possiblity.

Another one can be the redirection. A post can send output to multiple files or buffers.

We have a functionnality called redirectToFile that change the current output target.

https://cam.autodesk.com/posts/reference/classPostProcessor.html#a8612c292f8ea8f81813001392515d044

there is a function to close the redirection in order to switch back to the "regular file"

 

There is another function to redirectToBuffer, that will send the output into an array temporary stored in memory.

https://cam.autodesk.com/posts/reference/classPostProcessor.html#aa340ed7126b7659daafb1f475231b314

 

An example of implementation can be found in the fanuc turning post, for example, when generating the roughing canned cycle G71/72. Loook at the function onCyclePath, onCyclePathEnd.

Once you need to flush the buffer to a file, use the getBuffer functions.

https://cam.autodesk.com/posts/reference/classPostProcessor.html#a3d300af67f08e8eaa4548742ed519c5f

 

I may help you achieve your goal.

 

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
Message 3 of 8

Hi @serge.quiblier 

Thanks for the help.  I'm afraid this is above my pay grade...  I looked at the Fanuc turning post, but I don't think it is calling to another post here.  I really don't understand how to call another post, it's just too advanced for me I have to admit.

If you had an example of a post calling another post once the 1st post is done processing let me know, otherwise I think I'll just keep posting 3 times every time.   The thing is, these 3 posts are very distinct, they do not complete each other, they have their separate purpose, so I don't necessarily want to pass something as a buffer (although again, I don't fully understand what would be in this buffer), it's more like I want to post from scratch 3 times in a row.  Like post for Fanuc, once complete, post the same CAM file to Renishaw, once done, post again the same CAM file to the Tool List post I created.

 

You probably understood what I was after, most likely it is me who does not understand the answer hehe.  There wouldn't be something like, at the end of a post => "Call(Renishaw.cps)", you know, something as simple as that?

 

Thanks again!

Message 4 of 8
DarthBane55
in reply to: DarthBane55

Actually better yet, ideally, I would create a 4th post, which will be the one I would use in CAM, and this post would call the other 3 posts.  This way I can fully customize easily which posts I can run.  For example, this post would look like:

 

Call(Fanuc.cps) (runs this post and returns to next line)

Call(Renishaw.cps) (runs this post and returns to next line)

Call(Tool List.cps) (runs this post and returns to next line)

End

 

I know the syntax wouldn't be like that, it's just to make it simple to show what I'm after, I have no idea what the syntax would be in Javascript.  But is that even doable?

Message 5 of 8

Hi @DarthBane55 

 

No, the Fanuc post is not calling another post.

I was trying to explain, that output can be redirected into either a buffer, or another file.

To add all the functionalities in the same post, but outputting in different files.

 

Apparently, this is not your line of thought, or your desire.

 

Actually the only way to have several postings, is the use of cascading posts but it is limited to two posts.

 

When using your 3 posts, do they each have post properties?

 

Because cascading post, can display the 2 posts, allow you to manipulate each of the post properties.

 

Trying to find another way of posting may prevent using post properties in some posts.

 

Regards



Serge.Q
Technical Consultant
cam.autodesk.com
Message 6 of 8

Hi @serge.quiblier ,

I am already using a cascading post, on top of all that hehe.  I use NCSimul which requires the cascading post.  So that's out.  I understand now what you explained, about combining all 3 posts in 1 to output 3 files.  That would get very complex in that 1 giant post, it is not worth the effort for me, a really big project that would be. 

On top of that, I made this post to output for 2 different machines (robodrill 3-axis and robodrill 5-axis), and they both don't need all 3 posts output.   I know I could do some checks and skip the Renishaw output for the 3-axis, but yeah, it's already a complex post with all the checks in it for the 2 different outputs, I won't add more complexity.

Thank you very much for you help, I appreciate it.  I'll just keep on posting the 3 different files by posting 3 times, not that big a deal.

Message 7 of 8

Hi @DarthBane55 

 

here is a quick and dirty hack code for calling a post from another one.

But there are some limitations to what had been tested.

1 - the posts where all in the same folder, locally. I have not tested with posts stored in a cloud folder, and I have no idea what the getFolder function will be retrieving as path.

2 - We are not passing any properties (except we force the unit property) to the nth post.

As we won't be able to interrogate the UI for more than two posts, we can't get properties defined by the user.

But the code could be altered for passing constant value properties.

3 - The calling post should be the smart post i.e your Robodrill, to be able to access and have the properties passed correctly to him.

4 - Use it at your own risk.

5 - You can add as many calls to the callPost function, inside onTerminate as you may need.

 

Here is a simple callPost function, and using it inside the onTerminate.

onTerminate is defined and called when the current smart post has finished to create it's output. So, it's output file, is flushed on storage support, and closed.

Then we can do things like renaming it ...

In our case, we will call another instance of the post engine.

 

 

function callPost(postname, outputfile) {
  var outputPath = getOutputPath();
  var folderName = FileSystem.getFolderPath(outputPath);
  var postPath = findFile(postname);  // may need to be modified if cloud folder are used
  var intermediatePath = getIntermediatePath();
  var outputfilepath = folderName + "\\" + outputfile;

  var a = "--property unit " + ((unit == IN) ? "0" : "1"); // use 0 for inch and 1 for mm
  a += " --noeditor --log temp.log \"" + postPath + "\" \"" + intermediatePath + "\" \"" + outputfilepath + "\"";

  execute(getPostProcessorPath(), a, false, "");
}

function onTerminate() {
  callPost("xyz_ijk.cps", "destinationfileformycrap.txt");
}

 

 

Potential problem, if your processing thru the multiple posts is too long, we could be interrupted by a timeout.

I have also only tested by outputting code in a local folder, and not in Fusion team....

 

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
Message 8 of 8

@serge.quiblier 

You are a genius!  This is 100% working and what I was after.  I am lucky that I use local posts, everything aligns for me I suppose, it just works.  Exact perfection.

I just copied your callPost function integrally, and changed the line in the Terminate function as per below:

function onTerminate() {
  if (properties.A__Has_5Axis) {
    var outputPath = getOutputPath();
    var programFilename = FileSystem.getFilename(outputPath);
    var name = String(programFilename).split("." + extension);
    var newFolder = FileSystem.getFolderPath(outputPath) + "\\" + name[0] + ".RBX";
    FileSystem.copyFile(outputPath, newFolder);
    FileSystem.remove(outputPath);
  }
	callPost("Renishaw Laser - Tool Measuring.CPS", name[0] + ".LAZ");
	callPost("Tool List.CPS", name[0] + ".CSV");
}

Basically I just added the last 2 lines, the rest was there already, it might have been you who showed me how to rename a file.  Just because when we output for 3-axis we call it .RBD and 5-axis .RBX.

I will now simply add the logic for 3-axis to not output the Renishaw laser file, but that is really easy.

 

Thank you so much, this is a breakthrough for me.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report