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 Mod Brain Fart


huskermcdoogle
 Share

Recommended Posts

Guys,

 

I have been successful in getting custom drill parameters into the simple drilling cycle. Did some math and have it outputting like I want to. The issue I have is I cannot for the life of me figure out how to get it to toggle from G81 to G82 when I check the use custom parameters check box. Kinda like how the MPMaster post changes G81 to G82 when you add in a dwell in the simple drill cycle.

 

I am using a modified MPMASTER post, modified for some formatting things but nothing major. All of the main functions from the MPMASTER post are still there and mainly untouched, except for what I added for the custom parameters so far.

 

I am not looking for someone to do it for me, rather I am looking to learn more about post processor modifications. Through some educational nudges.

 

I am running X2 MR2.

 

Thanks,

Husker

Link to comment
Share on other sites

im no post guru but i think you would have to put in some kind of logic for that maybe steal it from MP and mod it to what you need

 

pdrlcommonb #Canned Drill Cycle common call, before

if sav_dgcode = 81,

[

if drillcyc$ = three, drlgsel = fsg1(-ss$) + drillcyc$ * two

else, drlgsel = fsg2(dwell$) + drillcyc$ * two

if clearflg = one & clearstrt = zero, drillref = zero

else, drillref = one

if absinc$, result = force(refht_i, refht_i)

else, result = force(refht_a, refht_a)

]

result = newfs (two, zinc)

 

pdrill$ #Canned Drill Cycle

pdrlcommonb

pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,

prdrlout, [if dwell$, *dwell$], *feed, strcantext, e$

pcom_movea

 

just thinking out loud

HTH

Link to comment
Share on other sites

Well to put a long story short I have tried all sorts of things in that area to no avail. I can't really make out what they are trying to do in that logic right there. Can anyone shed some light on that?

 

Esentially I need something with the logic that follows.

#---

if switch on & g81

[

make g82

]

#---

I have the switch on part figured out. I grabbed that parameter and put in a variable called custonoff, But what is the Gcode stored in and what format is it in.

Link to comment
Share on other sites

This is the key:

 

code:

*sgdrill  

so if you look at the logic from Tony's example you can see that when this gets a value then that makes the correct output. This variable is handled through this string.

 

 

code:

fstrsel scc0 cc_pos$ sccomp 3 -1

# --------------------------------------------------------------------------

# Canned drill cycle string select

sg81 G81 #drill - no dwell

sg81d G82 #drill - with dwell

sg83 G83 #peck drill - no dwell

sg83d G83 #peck drill - with dwell

sg73 G73 #chip break - no dwell

sg73d G73 #chip break - with dwell

sg84 G84 #tap - right hand

sg84d G74 #tap - left hand

sg85 G85 #bore #1 - no dwell

sg85d G89 #bore #1 - with dwell

sg86 G86 #bore #2 - no dwell

sg86d G86 #bore #2 - with dwell

sgm1 G76 #misc #1 - no dwell

sgm1d G76 #misc #1 - with dwell

sgm2 G81 #misc #2 - no dwell

sgm2d G82 #misc #2 - with dwell

sgc9 G81 #custom #9 - no dwell

sgc9d G82 #custom #9 - with dwell

sgdrill #Target for string

 

fstrsel sg81 drlgsel sgdrill 18 -1

So when the value of sgdrill is 2 then you get the G82 output. So you could do a simple mi statement like mi2$ = 1, sgdrill = two then this should override the default value and give you the code posted out like it should be when mi2 is zero and the G82 when mi2 is one for that operation.

 

HTH

Link to comment
Share on other sites

Yeah, I mentioned that earlier, but I don't want a dwell, granted I can put in a very small value, so it doesn't matter, I know myself and will forget to set a dwell as the switch whereas with the custom paramters I will not be able to forget when I go to turn it on. I would like to know how that works so that I can use it to my advantage. Plus I like to have clean gode so as to not confuse my operators. They always question codes that have not seen before.

Link to comment
Share on other sites

Tried your suggestion. Didn't work.

 

 

code:

pdrlcommonb     #Canned Drill Cycle common call, before

 

 

if sav_dgcode = 81,

[

if drillcyc$ = three, drlgsel = fsg1(-ss$) + drillcyc$ * two

else, drlgsel = fsg2(dwell$) + drillcyc$ * two

if clearflg = one & clearstrt = zero, drillref = zero

else, drillref = one

if absinc$, result = force(refht_i, refht_i)

else, result = force(refht_a, refht_a)

]

result = newfs (two, zinc)

 

if drillcyc$ = 3,

[

if mi6$, use_pitch = 1

else, use_pitch = sav_use_pitch

]

 

pcom_moveb

feed = fr_pos$

comment$

pcan

pbld, n$, sgabsinc, e$

 

#ABSOLUTE

if cuttype = one,

[

initht_a = initht$ + (rotdia$ / two) #Initial Height Abs

refht_a = refht$ + (rotdia$ / two) #Reference Height Abs

tosz_a = tosz$ + (rotdia$ / two) #Top of Stock Abs

]

if cuttype = three, #W is the current position during Gcode 11, it give refht for drill5ax

[

initht_a = w$ + (initht$ - refht$) #Top of Stock Abs

refht_a = w$ #Initial Height Abs

tosz_a = w$ + (tosz$ - refht$) #Reference Height Abs

]

if cuttype = zero | cuttype = two,

[

initht_a = initht$ #Initial Height Abs

refht_a = refht$ #Reference Height Abs

tosz_a = tosz$ #Top of Stock Abs

]

if sav_dgcode <> 100 & fmtrnd(initht_a) <> fmtrnd(prv_zabs) & opcode$ 3, #if using a ref point you need to update the XYZ coord before calling the drill cycle

[ #this applies to ref points with opcode 3 only

zabs = initht$

zinc = initht$ - prv_zabs

sav_gcode = gcode$

if convert_rpd$ = one,

[

gcode$ = one

feed = maxfeedpm

ipr_type = zero

]

else, gcode$ = zero

pbld, n$, sgabsinc, *sgcode, pxout, pyout, pfzout, e$

gcode$ = sav_gcode

]

if cuttype = one, zabs = depth$ + (rotdia$ / two) #Depth Abs

if cuttype = three, zabs = w$ + (depth$ - refht$) #Depth Abs

if cuttype = zero | cuttype = two, zabs = depth$ #Depth Abs

 

#INCREMENTAL (references absolute calcs)

if drillref = 1, #(Inc from refth)

[

initht_i = initht_a - refht_a #Initial Height Inc

refht_i = 0 #Reference Height Inc

tosz_i = tosz_a - refht_a #Top of Stock Inc

]

else, #(Inc from initht)

[

initht_i = 0 #Initial Height Inc

refht_i = refht_a - initht_a #Ref Height Inc

tosz_i = tosz_a - initht_a #Top of Stock Inc

]

zinc = zabs - refht_a #Depth Inc

 

if haas,

[

result = nwadrs(stri,peck1$)

result = nwadrs(strj,peck2$)

result = nwadrs(strk,peckclr$)

]

 

feedover = feedover/feed * 100 # put feedrate in percentage for G82

regfdpth = ((tosz_a - zabs - regfdpth)/regfdpth)*regfdpth # calculate I value for G82

 

pbld, n$, sgfeed, e$

 

if custonoff & drillcyc$ = 0, sgdrill = two

 


Notice the if statement at the end. Is this where the problem is? Changing the value of sgdrill does not seem to change anything. My If statement logic works, so that is not the problem, at least I do not think it is.... banghead.gif

Link to comment
Share on other sites

quote:

if custonoff & gcode$ = 81,

gcode$ = 82

I think John didn't mean this literally. "custonoff" is probably a suggestion for a flag to test for your condition. You could replace it with mi2$ or whatever you are using to "toggle" this feature on and off in your post.

 

Maybe something like:

code:

pdrill$          #Canned Drill Cycle

pdrlcommonb

if mi2$ & drlgsel = 0,

drlgsel = 1

pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,

prdrlout, [if dwell$, *dwell$], *feed, strcantext, e$

pcom_movea

Replace mi2$ wth whatever you are using as a trigger to swich cycles.

 

I'm not sure about using the custom drill parameters check box, but if you choose a custom parameter that has to be entered as a positive value in this situation, that drlparm$ would work in place of mi2$.

 

HTH wink.gif

Link to comment
Share on other sites

"custonoff" is a variable that I declared and pass the check box parameter to. As far as using it in a logic statement that part works fine. The problem I am having is where to use the logic statement. I will try the above suggested

 

code:

 

 

pdrill$ #Canned Drill Cycle

pdrlcommonb

if mi2$ & drlgsel = 0,

drlgsel = 1

pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,

prdrlout, [if dwell$, *dwell$], *feed, strcantext, e$

pcom_movea


only this is how I will do it.

 

code:

pdrill$          #Canned Drill Cycle

pdrlcommonb

if custonoff & drlgsel = 0,

drlgsel = 1

pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,

prdrlout, [if dwell$, *dwell$], *feed, strcantext, e$

pcom_movea


I don't want to use a MI it doesn't seem as clean. For what I am doing here. The Custom Parameters Checkbox is much more appropriate.

 

Thanks for all of the help so far. Much appreciated. I am still learning about mastercam posts as you aware. I have some C++ background and it is somewhat helpful, but some good reference literature, no matter how cryptic would be very helpful. Say for instance a list of common variables that are usable in any post by default. Having to track down a parameter that most likely is already stored in a variable, then put it in a variable is a pain in the butt. Though at least it can be done... Unlike some other cam systems....

 

 

Husker

Link to comment
Share on other sites

Got it working like a charm. Thanks for all of the help. This is what I ended up with.

 

code:

pdrlcommonb     #Canned Drill Cycle common call, before

.....

if custonoff,

[

feedover = feedover/feed * 100 # put feedrate in percentage for G82

regfdpth = ((tosz_a - zabs - regfdpth)/regfdpth)*regfdpth # calculate I value for G82

]

else,

[

feedover = zero

regfdpth = zero

]

 

....

 

 

pdrill$ #Canned Drill Cycle

pdrlcommonb

if custonoff & drlgsel = 0,

[

drlgsel = 1

]

 

pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,

prdrlout, [if dwell$, *dwell$], *feed, regfdpth, feedover, pcan1, strcantext, e$

pcom_movea

 

 


feedover, regfdpth, and custonoff, are variables that I defined, populated, and formatted from the on screen parameters. If anyone wants to know what parameters I grabbed shoot me a note. Thanks for all of the help guys, I learned a lot about post with this endeavor.

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