Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Subprogram size.


Recommended Posts

I'm assuming by size that you mean the number of lines versus memory size.

 

In order to do this, you would need to do this you could do one of two things:

 

1) either start a line counter, and every time a line is output increment the counter by one until you have finished the sub program, then copy the sub either into a file to be merge or it's own unique directory.

 

2) write out the subprogram to an external file, after that's complete, read the output file in as a buffer and check the buffer size to determine the number of lines (this is the preferred method). Then make your decision based on the size whether to copy the sub into a file to be merge later, or leave it in it's own separate file.

 

Using either method I believe you will need to delay the output of the sub call (M98/M198) as the call will be dependent on whether or not the sub will be merged later and you won't know this until after the sub has been output. Unfortunately in this case, mastercam will output the call to the sub prior to actually writing the sub.

 

I may be over thinking this one but I'm guessing those are the only ways to do it and either way will require some knowledge of how the post can manage files. This may be a more complex modification than you realize...but perhaps someone here has done it before and can offer up the appropriate code snippets....

 

 

HTH

Link to comment
Share on other sites

Interesting idea, but, the number of lines from a file cannot ensure a specific size. You know I can have a parallel finish with most of the movement in one dir only, so 1 value in a line (metric values), or a 5x simultaneous with 5 values in one line (imperial values), so imagine the difference. I was thinking at a function that can check a size of a file. But after double checking the MP Post Ref Guide, it seems there isn’t such a function. Thanks man.

Link to comment
Share on other sites

If you create a utility in another programming language to determine file size, you can run it as an executable from the post using the launch command.

 

The launch command has the following format.

 

result = launch(<utility_name>,<input>)

 

The input would be the external file you created during posting and it would need the entire path in quotations. For example, "C:\mcamx\mill\NC\Test.ext".

 

The utility name would be formatted the same way, "C:\My Utility\Utility.exe".

 

The variable result is a numeric variable.

Link to comment
Share on other sites

Simple (???) solution is what we're implementing into our post at the moment.

Have a Misc Int where you state to use the 'external' sub.

When '1', is selected, mcam posts M198 and outputs the sub so you can cut it out the main and paste it onto the pcmcia card.

We thought long and hard over how to do this simply, and this seemed the best result for us.

If you go this way, you need to know what toolpath(s) is going to be the biggie, but being honest, optirough or any of the dynamics (for us anyway) mean that the posted prog probably won't fit into the control memory so we know we have to run the external sub anyway.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...