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:

Problems with Misc Integers in MC8 post


Recommended Posts

Hello all,

 

I am trying to use mi5 to turn on AINano (similar to HSM on my Bridgeport 760XP3) and am running into problems. I am running Mcam 8.1 and I have it almost working I just need to tweak it a little.

 

AI Nano is called out like this:

 

N200
(1/2 FLAT ENDMILL )
G49
G5.1Q1R4            
T2M6

 

And it's turned of by using:

G5.1Q0

 

G5.1 is the code for the AI Nano mode, Q turns it either on or off, and R(shsms) is a number 0-9 to tell it how much to fudge the corners.

 

I have mi6 set up as that R value using a formula (shsms = mi6), and that works fine. I put the following code in to my post:

 

phsm		#High speed machining on

     if mi5 = one, 
[
*"G49", e
*"G5.1Q1R",*shsms, e
]


phsmoff		#High speed machining off

     if mi5 = one, 
[
*"G5.1Q0", e
]

 

I then put a phsm callout between ptoolcomment and the toolchange line in both the ptlchg and psof sections of the post. Like so:

ptoolcomment
     comment
     pbld, phsm, e
     pcan
     pbld, *t, "M6", e
     pindex

 

I also put phsmoff in the pretract section of the post. Like so:

gcode = zero
     pbld, phsmoff
     pbld, sccomp, scoolant, psub_end_mny, e

 

Now the problem I have is that it doesn't always associate turning AI Nano off with the correct tool. Say I have T1 a drill (Misc Values box unchecked), T2 an endmill(Misc Values box checked and mi5 as 1), and T3 a tap(Misc Values box unchecked also). What happens is I will get the G5.1Q0 line at the end of T1 instead of the end of T2. It will however turn AI Nano on correctly for T2, but it won't turn it off for T2.

 

After turning the debugging lines on I see that the command to turn AI Nano off in T1 comes from pretract even though the Misc Values for that tool are off. So it is looking at the value for mi5 from the next tool. I have read online about using sav_mi5 to save it, but can't seem to get it to work.

 

Any help would be appreciated.

 

Thanks,

Jerry

Link to comment
Share on other sites

the problem I assume comes from the fact that your pretract block may be called from your ptlchg postblock. Therefore when you get into your phsmoff block, you are looking at the wrong value of the mi5. What you could do is to simply use an intermediate value like sav_mi5 or last_mi5 taht will save the mi5 value after each toolchange (at the end of the ptlchg block) and refer to this value in your phsmoff block.

 

This shoudl do the trick inmy opinion.

 

HTH

Link to comment
Share on other sites

Yes, my phsmoff is called up through pretract which is then called up through peof.

 

So I defined my variable like so:

 

#Misc variables
sav_mi5     : 0      #Saved mi5 value

 

And at the beginning of psof, ptlchg, and ptlchg0 I added:

 

mi5 = sav_mi5

 

I then changed my phsm and phsmoff as follows:

 

phsm		#High speed machining on

     if sav_mi5 > zero, 
[
"G49", e
"G5.1Q1R",*shsms, e
]


phsmoff		#High speed machining off

     if sav_mi5 > zero, 
[
"G5.1Q0"
]

 

The problem this presents is that sav_mi5 is defined by the initial definition line. It does not save the current integer in its place with the code:

mi5 = sav_mi5

 

So if I leave that initialization definition at 0 it won't turn on at all. If I change it to 1 it will be on for every tool.

 

Any clue as to what I am doing wrong?

Link to comment
Share on other sites

I think your best bet is probably to make a flag so that once the high speed has been turned on, the post knows. That way when you are retracting, you will only turn off the high speed if it's actually been turned on.

 

So if operation 1 has it unchecked, operation 2 is checked, operation 3 is unchecked, it would turn on in ptlchg and when you go to retract, the flag would tell you it needs to turn off.

 

phsm            #High speed machining on

     if mi5 = one & hsm_flg = 0, 
       [
       *"G49", e
       *"G5.1Q1R",*shsms, e
       hsm_flg = 1
       ]

phsmoff         #High speed machining off

     if hsm_flg, 
       [
       "G5.1Q0"
       hsm_flg = 0
       ]

 

Hopefully this isn't too convoluted, let me know if it is and I'll try to explain a bit better, but the bottom line is this method only turns the function off if it's been turned on. Since turning on the hsm happens at the start of the operation, you can use the current mi5 value and then you don't need to worry about it until the next time you want to enable it. Just keep in mind that every time phsmoff is called after the hsm has been enabled, it will cancel the code, so only call phsmoff when you want the hsm turned off which usually ties the code to pretract.

Link to comment
Share on other sites

Chris, thanks for the quick reply. I understand what you are saying, but it still depends on that initial definition line. If I put a 0 in there it won't put the hsm code in at all, if I change it to a 1 it will put only the shut off code, and then it will put it for only the first tool. Am I defining it wrong?

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