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:

Calculating Number Of Depth Cuts


Recommended Posts

Hello everyone,
   I am now constantly working on steel parts which involve many "DEPTH CUTs" and I would like to calculate how many MAX ROUGH STEP from depth cut...   For instance, My "Z DEPTH" is -.300 and I would like 2x rough depth cuts as .150 each.  I tried to write it and somehow it showed me "0X" times at .150 per rough depth cut.  Below these dotted lines are my defined and I know I did something wrong, I am just blind do it my own mistakes.  Please help me out, thank you for your time for giving me a hand.

+++++++++++++++++++++++++++++++++++++++++++
G-CODES

N49( .6000,5/8 SHELL MILL, TiNC, .025RAD, ROUGHER,)
(4FLTS .025LOC, 1.000RLF, 2.00STO)
G0 G17 G40 G49 G80 G90
G91 G28 Z0 M19
/G28 Y0 M8(AREA MILL)
T49 M6(ROUGH OUT TOP SURFACE, CUT#89)
G90 G54 X-.6289 Y6.7929
S3180 M3
(0X, .15 PER ROUGH DEPTH CUT) ===========================> It should show 2X
(.05 -.1 STEPOVER, 16.6667PERCENT)
G43 H49 Z1. (DOC= Z.06)
Z.3312
G1 Z.18 F50.
G3 X-.6372 Y6.7744 R.1623
(FIRST SECTION CUTTING...)
G3 X2.2231 Y6.4299 R.0125
G1 X2.222 Y6.4494
G0 Z.125
Z.2112
X-5.0758 Y-4.5567
G1 Z.06
(SECOND SECTION CUTTING...)
Y.0068
G0 Z1.
M9
G91 G28 Z0. M5
/G28 Y0.
G0 G90 G54 X0.
M30(76,465CHARS - 76.71KB)
%

============================ POST DEFINED =========================

#Region pMaxRoughDepthCutsCount
pMaxRoughDepthCutsCount spaces$ = 0 if opcode$ = 2, #| tool_op$ = 2, # | opcode$ = 4, if MaxRoughDepth > 0, 
 NumberOfRoughDepthCuts = (abs(operation_depth)+ abs(BreakThroughAmount))/MaxRoughDepth 

fmt    4 DepthCuts #Flag for Depth Cuts
fmt    2 MaxRoughDepth #Flag for Depth Cuts
fmt    4 NumberOfFinishCuts
fmt    2 ZDepthOfFinishCuts
fmt    4 NumberOfRoughDepthCuts

#Region pMaxRoughDepthCutsCount
pMaxRoughDepthCutsCount
      spaces$ = 0
      if opcode$ = 2, #| tool_op$ = 2, # | opcode$ = 4,
       if MaxRoughDepth > 0, NumberOfRoughDepthCuts = (abs(operation_depth)+ abs(BreakThroughAmount))/MaxRoughDepth
        [
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " ROUGH DEPTH CUTS)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts < .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " PER ROUGH DEPTH CUT)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts = 1 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUT, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X FINISH DEPTH CUT", *ZDepthOfFinishCuts, " EACH)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH DEPTH CUTS)", e$
        ]
      spaces$ = sav_spc
	  NumberOfRoughDepthCuts = 0 
	  NumberOfFinishCuts = 0
	  NumberOfRoughDepthCuts = 0
	  MaxRoughDepth = 0
	  NumberOfFinishCuts = 0
	  ZDepthOfFinishCuts = 0
#EndRegion
#Region Tool change common blocks
ptlchg_com      #Tool change common blocks
pMaxRoughDepthCutsCount

#EndRegion

 

#Region Null tool change
ptlchg0$         #Call from NCI null tool change (tool number repeats)
pMaxRoughDepthCutsCount
#EndRegion
pparameter$ # Run parameter table
           if prmcode$ = 15084, NumEntities = rpar(sparameter$, 1)
           if prmcode$ = 15211, DepthCuts = rpar(sparameter$, 1)
           if prmcode$ = 10065, MaxRoughDepth = rpar(sparameter$, 1)
           if prmcode$ = 10066, NumberOfFinishCuts = rpar(sparameter$, 1)
           if prmcode$ = 10067, ZDepthOfFinishCuts = rpar(sparameter$, 1)

 

  • Like 1
Link to comment
Share on other sites
16 hours ago, jlw™ said:

This comment may be way out of line but dude you want the weirdest things in your posts.  I am curious though, why would you want this?

When you are having 5 depth cuts or more, the setupman may have to spend mich time to search for Z value.

 

If you let it comments out, you and setup man will become pal within minutes not hour.

  • Like 2
Link to comment
Share on other sites

Not to get off topic but a serious question to understand your way of programming and working:-

Why?

Why does the setup man need to see this? In the old days with sub progs yes - setup man earnt his money and would cut depth cuts out if not necessary or add as appropriate. But with todays system and verify etc, do you not post and run?

  • Like 1
Link to comment
Share on other sites
10 hours ago, Newbeeee™ said:

Not to get off topic but a serious question to understand your way of programming and working:-

Why?

Why does the setup man need to see this? In the old days with sub progs yes - setup man earnt his money and would cut depth cuts out if not necessary or add as appropriate. But with todays system and verify etc, do you not post and run?

Hello Newbee,

    I usually program and running my own part and if someone running my program, I don't want him misunderstanding of what I want.

 

Most set man knows what they are doing and the thing is "time", he may be scrowing up and down to read the Z values to take a good guys what is the programmer really wants to do?

 

Why not us giving clear note in the post that the programmer really wants the program do instead of guessing?

 

Honestly, I like to be exact and fast instead of guessing which may cause running bad parts and frustration.

 

Thank you for your feedback to allow mw to explain.

  • Like 1
Link to comment
Share on other sites

If you are using Mastercam 2017+ you should try the opinfo function;  opinfo provides a much more efficient way to get parameter information than pparameter$.

Below is a very simple post block/snippet showing opinfo in use for this application.

 

hasDepthCuts  : 0
roughStep     : 0
toolpathDepth : 0
numberOfCuts  : 0
currentCut    : 1

fmt 4 currentCut
fmt 4 numberOfCuts
      
pDepthCutCount
      if prv_op_id$ = op_id$,
      [
        hasDepthCuts = opinfo(15211, 0)
        if hasDepthCuts = yes$,
        [
          roughStep = opinfo(10065, 0)
          toolpathDepth = opinfo(10029, 0)
          numberOfCuts = abs(toolpathDepth)/abs(roughStep)
          n$, "( Depth Cut ", *currentCut, "of ", *numberOfCuts, " )", e$        
          if numberOfCuts = currentCut, currentCut = 1
          else, currentCut = currentCut + 1
        ]
      ]

 

  • Thanks 1
  • Like 1
Link to comment
Share on other sites
37 minutes ago, jeff.D said:

If you are using Mastercam 2017+ you should try the opinfo function;  opinfo provides a much more efficient way to get parameter information than pparameter$.

Below is a very simple post block/snippet showing opinfo in use for this application.

 


hasDepthCuts  : 0
roughStep     : 0
toolpathDepth : 0
numberOfCuts  : 0
currentCut    : 1

fmt 4 currentCut
fmt 4 numberOfCuts
      
pDepthCutCount
      if prv_op_id$ = op_id$,
      [
        hasDepthCuts = opinfo(15211, 0)
        if hasDepthCuts = yes$,
        [
          roughStep = opinfo(10065, 0)
          toolpathDepth = opinfo(10029, 0)
          numberOfCuts = abs(toolpathDepth)/abs(roughStep)
          n$, "( Depth Cut ", *currentCut, "of ", *numberOfCuts, " )", e$        
          if numberOfCuts = currentCut, currentCut = 1
          else, currentCut = currentCut + 1
        ]
      ]

 

 

Thank you Jeff, this is what am I looking for.  Once again thank you, I will feedback after integrating your codes into my post.  

Link to comment
Share on other sites

Jeff/Steven,

The "new" 'opinfo' functions are not compatible with the "Pre-Read" functionality. ('pwrtt$').

You can't use "both" the new logic, and the "old" logic in the same Post. It is only one, or the other.

Steven,

To implement this new style of logic in your Post, means you have to completely throw away all the old 'pparameter$' logic.

If you want to use the "new" stuff, you must start over with a "fresh" Post, and delete the "pparameter$ and pwrtt$' logic.

Good luck, but I don't think this is something you should try.

  • Like 1
Link to comment
Share on other sites

Hi Jeff,
   After I took a look at your valuable codes, I have found out that I missed the "VARIBLE" values define.   Below here what I did, once again thank you for your help.


++++++++++++G-Codes++++++++++++++++++
N44( .5000,1/2 BULL EM, CB, .030RAD, USED TOOL,)
(3FLTS 1.000LOC, 1.50STO)
G0 G17 G40 G49 G80 G90
G91 G28 Z0 M19
/G28 Y0
T44 M6(, CUT#204)
G90 G54 X6.75 Y0.
S3820 M3
(2X, .035 ROUGH DEPTH CUTS) ======> It is now showing 2x times.
G43 H44 Z1. M8(DOC= Z0.)
Z.1325
G1 Z.035 F5. ======> First time of depth cut.
G2 X6.75 Y0. I-6.75 F25.
G1 Z0. F5.======> Second time of depth cut.
G2 X6.75 Y0. I-6.75 F25.
G0 Z1.
M9
G91 G28 Z0. M5
/G28 Y0.
G0 G90 G54 X0.
M30
%

=====================POST DEFINED=====================

#Region Common user-defined variable initializations (not switches!)
# --------------------------------------------------------------------------
# Common User-defined Variable Initializations (not switches!)
# --------------------------------------------------------------------------

DepthCuts: 0
MaxRoughDepth: 0
NumberOfFinishCuts: 0
ZDepthOfFinishCuts: 0
NumberOfRoughDepthCuts: 0
#EndRegion
 
 
#Region Custom FMT
# --------------------------------------------------------------------------
# Custom FMT
# --------------------------------------------------------------------------

fmt    4 DepthCuts
fmt    2 MaxRoughDepth
fmt    4 NumberOfFinishCuts
fmt    2 ZDepthOfFinishCuts
fmt    4 NumberOfRoughDepthCuts
#EndRegion
 

#Region pMaxRoughDepthCutsCount
pMaxRoughDepthCutsCount
      spaces$ = 0
      if opcode$ = 2,
       if MaxRoughDepth > 0, NumberOfRoughDepthCuts = (abs(operation_depth)+ abs(BreakThroughAmount))/MaxRoughDepth
        [
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " ROUGH DEPTH CUTS)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts < .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " PER ROUGH DEPTH CUT)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts = 1 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUT, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X FINISH DEPTH CUT", *ZDepthOfFinishCuts, " EACH)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH DEPTH CUTS)", e$
        ]
      spaces$ = sav_spc
         NumberOfRoughDepthCuts = 0
         NumberOfFinishCuts = 0
         NumberOfRoughDepthCuts = 0
         MaxRoughDepth = 0
         NumberOfFinishCuts = 0
         ZDepthOfFinishCuts = 0
#EndRegion
 
 
#Region pparameter
pparameter$ # Run parameter table

         if prmcode$ = 15084, NumEntities = rpar(sparameter$, 1)
         if prmcode$ = 15211, DepthCuts = rpar(sparameter$, 1)
         if prmcode$ = 10065, MaxRoughDepth = rpar(sparameter$, 1)
         if prmcode$ = 10066, NumberOfFinishCuts = rpar(sparameter$, 1)
         if prmcode$ = 10067, ZDepthOfFinishCuts = rpar(sparameter$, 1)
#EndRegion
#Region pMaxRoughDepthCutsCount
pMaxRoughDepthCutsCount
      spaces$ = 0
      if opcode$ = 2
       if MaxRoughDepth > 0, NumberOfRoughDepthCuts = (abs(operation_depth)+ abs(BreakThroughAmount))/MaxRoughDepth
        [
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " ROUGH DEPTH CUTS)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts < .9999 & NumberOfFinishCuts = 0, pbld, no_spc$, no_spc$, "(", *NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " PER ROUGH DEPTH CUT)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts = 1 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUT, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH)", e$
         if DepthCuts = 1 & NumberOfRoughDepthCuts > .9999 & NumberOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", NumberOfRoughDepthCuts, "X, ", *MaxRoughDepth, " DEPTH CUTS, ", NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISHES)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts = 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X FINISH DEPTH CUT", *ZDepthOfFinishCuts, " EACH)", e$
         if DepthCuts = 1 & ZDepthOfFinishCuts > 1, pbld, no_spc$, no_spc$, "(", *NumberOfFinishCuts, "X ", *ZDepthOfFinishCuts, " FINISH DEPTH CUTS)", e$
        ]
      spaces$ = sav_spc
      NumberOfRoughDepthCuts = 0 
      NumberOfFinishCuts = 0
      NumberOfRoughDepthCuts = 0
      MaxRoughDepth = 0
      NumberOfFinishCuts = 0
      ZDepthOfFinishCuts = 0
#EndRegion
#Region Tool change common blocks
ptlchg_com      #Tool change common blocks
      pMaxRoughDepthCutsCount ======> Output here
#EndRegion

#Region Null tool change
ptlchg0$         #Call from NCI null tool change (tool number repeats)
      pMaxRoughDepthCutsCount======> Output here
#EndRegion


 
Link to comment
Share on other sites
1 hour ago, Colin Gilchrist said:

Jeff/Steven,

The "new" 'opinfo' functions are not compatible with the "Pre-Read" functionality. ('pwrtt$').

You can't use "both" the new logic, and the "old" logic in the same Post. It is only one, or the other.

Steven,

To implement this new style of logic in your Post, means you have to completely throw away all the old 'pparameter$' logic.

If you want to use the "new" stuff, you must start over with a "fresh" Post, and delete the "pparameter$ and pwrtt$' logic.

Good luck, but I don't think this is something you should try.

That's not exactly true.  You can use opinfo with the old preread post block, you just won't get the efficiently benefits of opinfo.  This is because the preread postblocks will still loop.

So yes, it is better and you should move your post to use the new opinfo functions, but the post should still work with opinfo and preread postblocks. 

  • Like 1
Link to comment
Share on other sites
On ‎3‎/‎12‎/‎2018 at 7:36 AM, jeff.D said:

That's not exactly true.  You can use opinfo with the old preread post block, you just won't get the efficiently benefits of opinfo.  This is because the preread postblocks will still loop.

So yes, it is better and you should move your post to use the new opinfo functions, but the post should still work with opinfo and preread postblocks. 

Hi Jeff,
   Thank you for your valuable input, I will try that and feedback to you ASAP.

 

Thanks,
  S.Luong

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