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 nesting / external


Recommended Posts

I am using a MPMaster based post.  The machine is a Mori NH4000 which doesn't have a lot of memory but a huge hard drive where I like to put larger toolpaths in "Tape Mode".  I program using transforms to create my subprograms.  Currently the sub programs are nested inside in the same output file under the main program.  Is there away to have these post out as different files?  I currently have to manually break up the files and its a pain since these files are huge.  Just wondering if there is an easier way.

Link to comment
Share on other sites

Yes.

At the "End of File (peof$), there is usually a "mergesub" command. This is the command that "loads the Subprograms" at the end of the file. Prior to running the 'mergesub' command, the Subroutines already exist in a separate file. It a simple matter to "rename" this file, change the File Extension, or change the location of the Subroutine File. There are many "File Manipulation" commands available in the MP Language.

  • Like 1
Link to comment
Share on other sites

OK one more thing.  I have it posting out with the subout$ = one and the subprg$ = 3 (.sub).  When it writes the files for the subs it uses the main program file name plus the "sub" and overwrites itself (I should have 60+ sub programs but end up with 1).  I know subout$=one will overwrite all data or create new file if it doesn't exists.  So I know why it is doing it I need to figure out how to change the file name to be the subprogram number.  Might be to tired tonight but hopefully this makes sense.

Link to comment
Share on other sites

To change the "Subprogram File Name", to "match exactly" the Subroutine Number (O3200.SUB), you need to employ a special trick.

      snamesub$ = drs_str(2, sub_prg_no$)

The "Dress String" function (when using Function Mode 2), tells MP to "Format the String, as it would for output". This means it take the "Sub number" (value of the variable), and it appends the String Character at the start. (Typically an "O", although it could be a "P" or any other character.) Technically, the MP Language supports "Suffix" strings as well, so if there was a suffix string associated with that variable (sub_prg_no$), that would get added as well.

If you just tried to use the 'sub_prg_no$' variable directly, you would get a "type conversion" error, since 'sub_prg_no$' is a numeric variable, not a "string". You could use another function to simply convert 'sub_prg_no$' to a String Variable, but it would leave off the prefix "O" when using that function. That is why the 'Dress String' function is so handy...

 

  • Like 2
Link to comment
Share on other sites
  • 2 years later...

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...