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:

Post Processor coding


Guest
 Share

Recommended Posts

Hi all,

I've been practicing the post processing writing a bit this weekend.

I noticed the user defined names in the posts I see are a bit unclear as to what they do a lot of shortened names,

For my posts that I'm writing I think I might use a camel case like we do for the chook and nethook programming.

In the following example the user defines variables are written like this

stringOpenParentheses    : "("   #String for open parenthesis "("
stringCloseParentheses   : ")"   #String for close parenthesis ")"
stringDelimiter   : "|"   #String for delimiter 

I think that makes it more clear to the end user what everything does. JM2c

[POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V23.00 P0 E1 W23.00 T1596718960 M23.00 I0 O1
# Post Name           : CUSTOM POST
# Product             : Mastercam
# Machine Name        : MACHINE
# Control Name        : CONTROL
# Description         : MASTERCAM POST
# Subprograms         : YES
# Executable          : MP v11.0
# Post Revision       : 0

# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ---------------------- Break ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#

# -------- Start of Miscellaneous Strings -------- #

stringOpenParentheses    : "("   #String for open parenthesis "("
stringCloseParentheses   : ")"   #String for close parenthesis ")"
stringDelimiter   : "|"   #String for delimiter

# -------- End of "Miscellaneous Strings" -------- #


# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ---------------------- Break ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#


# -------- Stat of "Header Info" -------- #

pheader$         #Call before start of file

      "%", e$
      !spaces$, spaces$ = 0
      spathnc$ = ucase(spathnc$)
      smcname$ = ucase(smcname$)
      stck_matl$ = ucase(stck_matl$)
      snamenc$ = ucase(snamenc$)
      stringOpenParentheses, "MCX FILE - ", *smcpath$, *smcname$, *smcext$, stringCloseParentheses, e$
      stringOpenParentheses, "NC FILE - ", *spathnc$, *snamenc$, *sextnc$, stringCloseParentheses, e$
      stringOpenParentheses, "MATERIAL - ", *stck_matl$, stringCloseParentheses, e$
      spaces$ = prv_spaces$

# -------- End of Header Info -------- #



# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ---------------------- Break ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#


# -------- Start of "Comment Info" -------- #

pcomment$        #(must call pcomment2 if booleans)
      pcomment2

pcomment2       #Output Comment from manual entry
      !spaces$, spaces$ = 0
      scomm$ = ucase (scomm$)
      if gcode$ = 1008, stringOpenParentheses, scomm$, stringCloseParentheses, e$  #Operation comment
      if gcode$ = 1051, stringOpenParentheses, scomm$, stringCloseParentheses, e$  #Machine name
      if gcode$ = 1052, stringOpenParentheses, scomm$, stringCloseParentheses, e$  #Group comment
      if gcode$ = 1053, stringOpenParentheses, scomm$, stringCloseParentheses, e$  #Group name
      if gcode$ = 1054, stringOpenParentheses, scomm$, stringCloseParentheses, e$  #File Descriptor
      spaces$ = prv_spaces$

      ##### Stop custom changes #####

# -------- End of "Comment Info" -------- #



# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ---------------------- Break ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#



# -------- Start of "Start Of File" Info -------- #
         
psof$            #Start of file for non-zero tool number

        ##### Custom changes allowed below #####
        

peof0$           #End of file for tool zero
      peof$
	  
	  
	  
#End of file for non-zero tool

# -------- End of "Start Of File" Info -------- #



# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ---------------------- Break ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#
# ----------------------       ------------------------#


# -------- Start of "End Of File" Info -------- #

peof$ 
         #Write the G28 A0. Line
         n$, "G28", "A0.", e$    
         #Write the % EOF Line
         n$, "M30", e$           #Write the M30 Line
         #mergesub$
         #clearsub$
         #mergeaux$
         #clearaux$
         "%", e$   	  
	  
#End Region

# -------- End of "End Of File" Info -------- #

 

Link to comment
Share on other sites

If a variable has a $ at the end, it's a system variable and that name cannot be changed

Those of us who have dug around in posts for awhile know what the other variables are...

If you were going to write your own post engine, yeah I can see it...if you're modding existing posts, it probably doesn't make a lot of sense to rewrite a huge portion of what already works.

JM2C

Link to comment
Share on other sites
Just now, JParis said:

If a variable has a $ at the end, it's a system variable and that name cannot be changed

Yeah I knew that going in, I was purely speaking on the User Defined varables.

1 minute ago, JParis said:

If you were going to write your own post engine, yeah I can see it...if you're modding existing posts, it probably doesn't make a lot of sense to rewrite a huge portion of what already works.

Yeah I was thinking more for new posts, updating existing posts using find and replace could be error prone..

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