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:

Moving a G40/G41/G42 callout


Recommended Posts

Hi, new to the forum, and pretty new to modifying the post. I've only helped my supervisor at previous company modify a post.

First thing first, I've already backed up my current post. I'm want to modify the post for my MasterCAM Mill 2017. I am using a CNT Motion Router using WinCNC for conrtol at the machine. I have 2 issues to solve regarding this issue:

1. The WinCNC software does not read a typical D## after it reads a G41/G42 for offset. The tool comp size is automatically read when the tool is loaded. I cannot have any D## callouts in my program because it is not supported by WinCNC. (there is only 1 comp. size available for each tool)

Can someone give insight on how to remove this from my post?

2. I also need to have my G40/G41/G42 on their own line in my program. How can I accomplish this?

I've made all these changes to the program by hand and confirmed they work. I just need mastercam to post the automatically.

Here is an example of what my post creates now: 

[1/8" SINGLE FLUTED SPIRAL END MILL]
M5
T2
M3

G0 X7.749 Y11.3001
S17500
G0 Z.5
G1 Z.1225 F100.
G1 X7.762
G1 G42 D2 X7.775
G3 X7.723 Y11.3001 I-.026 J0.
G3 X7.775 Y11.3001 I.026 J0.
G3 X7.7743 Y11.3059 I-.026 J0.
G1 G40 X7.7617 Y11.303

 

Here is an example of what I need:

[1/8" SINGLE FLUTED SPIRAL END MILL]
M5
T2
M3

G0 X7.749 Y11.3001
S17500
G0 Z.5
G1 Z.1225 F100.
G1 X7.762
G42
G1 X7.775
G3 X7.723 Y11.3001 I-.026 J0.
G3 X7.775 Y11.3001 I.026 J0.
G3 X7.7743 Y11.3059 I-.026 J0.
G40
G1 X7.7617 Y11.303

 

Link to comment
Share on other sites

You've presented a very well explained query, so I've decided to help you out in your quest. The first step is to watch this instructional video, to get in the proper Post Editing Mood.

 

Once you have obtained the proper mood for making the edits, we can continue on to the actual code changes.

Without getting into all the details of how everything works, it is important for you to understand that Mastercam has a "mechanism" already built into the Post to track the "state" of the Comp Mode. The "string" output (G40/G41/G42) is controlled by a 'String Select Function'. The Target String is 'sccomp', and is found inside the 'pccdia' Post Block.

That is where the "output" of the String is coming from. In addition, inside 'pccdia' is the "mechanism" and code to output the "Dxx" Diameter Compensation Number, which you want to suppress. The variable that outputs this "Dxx" comp value is 'tloffno$'. We can turn off that "Dxx" number by "commenting out" the line of code that tests for output.

So, the best way I think to accomplish your desires is by making the following edits to the Post:

First, find the 'pccdia' Post Block, and make the following edits:

pccdia          #Cutter Compensation
      #Force Dxx#   
      if prv_cc_pos$ <> cc_pos$ & cc_pos$, prv_tloffno$ = c9k
      sccomp   # cmg_note: this line outputs "G40/G41/G42"!!!
      # cmg_note: We comment out the line below, to suppress "Dxx" code!
	  #if cc_pos$, tloffno$  

 

After you've modified 'pccdia', search for 'plinout'. You want the area where 'prapidout', 'plinout', and 'pcirout' are defined.

You need to modify these 3 different "Output Blocks", to "call" a Post Block, that you are going to add in, above 'prapidout'.

I'll do a "Before":

# --------------------------------------------------------------------------
# Motion NC output
# --------------------------------------------------------------------------
#The variables for absolute output are xabs, yabs, zabs.
#The variables for incremental output are xinc, yinc, zinc.
# --------------------------------------------------------------------------
prapidout       #Output to NC of linear movement - rapid               
      pcan1, pbld, n$, sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, strcantext, pscool, e$
      #Modify following line to customize output for high-speed toolpath
      #tool inspection/change points
      if rpd_typ$ = 7, pbld, n$, "M00", "(TOOL INSPECTION POINT - POST CUSTOMIZATION REQUIRED)", e$

plinout         #Output to NC of linear movement - feed                    
      pcan1, pbld, n$, sgfeed, sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, feed, strcantext, pscool, e$
      #Modify following line to customize output for high-speed toolpath
      #tool inspection/change points
      if rpd_typ$ = 7, pbld, n$, "M00", "(TOOL INSPECTION POINT - POST CUSTOMIZATION REQUIRED)", e$

pcirout         #Output to NC of circular interpolation
      pcan1, pbld, n$, `sgfeed, sgplane, sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, parc, feed, strcantext, pscool, e$

 

And and "After":

# --------------------------------------------------------------------------
# Motion NC output
# --------------------------------------------------------------------------
#The variables for absolute output are xabs, yabs, zabs.
#The variables for incremental output are xinc, yinc, zinc.
# --------------------------------------------------------------------------
# 'pcomp_out' is used to output Compensation codes on a separate line of NC code
# If "no output" is detected from 'pccdia', then the
# entire line of NC Code will be suppressed
pcomp_out   #Post Block to output G40/G41/G42 based on NCI flags
      pbld, n$, pccdia, e$     # cmg - addded comp out, on separate line

prapidout       #Output to NC of linear movement - rapid               
      pcomp_out #Call to comp out
	  pcan1, pbld, n$, sgplane, `sgcode, sgabsinc,      # cmg - removed: pccdia,
        pxout, pyout, pzout, pcout, strcantext, pscool, e$
      #Modify following line to customize output for high-speed toolpath
      #tool inspection/change points
      if rpd_typ$ = 7, pbld, n$, "M00", "(TOOL INSPECTION POINT - POST CUSTOMIZATION REQUIRED)", e$

plinout         #Output to NC of linear movement - feed                    
      pcomp_out #Call to comp out
	  pcan1, pbld, n$, sgfeed, sgplane, `sgcode, sgabsinc, # cmg - removed: pccdia,
        pxout, pyout, pzout, pcout, feed, strcantext, pscool, e$
      #Modify following line to customize output for high-speed toolpath
      #tool inspection/change points
      if rpd_typ$ = 7, pbld, n$, "M00", "(TOOL INSPECTION POINT - POST CUSTOMIZATION REQUIRED)", e$

pcirout         #Output to NC of circular interpolation
      pcomp_out #Call to comp out
	  pcan1, pbld, n$, `sgfeed, sgplane, sgcode, sgabsinc, # cmg - removed: pccdia,
        pxout, pyout, pzout, pcout, parc, feed, strcantext, pscool, e$

 

 

  • Thanks 1
  • Like 4
Link to comment
Share on other sites

I guess technically, having it there won't do any harm, since it is already being "output" by the line ahead of the normal "output line". This is where the "modality" of MP kicks in, and saves the day. Having an extra call to 'pccdia' won't "do anything", because the modality of the String Select Function comes into play. Since "G41 or G42" has already been output, the extra call to 'pccdia' won't "do" anything, which is why leaving it there does no harm.

  • Like 1
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...