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:

Selective spindle output in toolchange output


DRIPPY
 Share

Recommended Posts

Hi All,

I have written a macro for my control to hone bores using a flex - hone.  Due to the flimsy nature of these tools it is generally a good idea to only start the spindle once the flex-hone is partially in the hole to avoid whipping. The spindle on M3 command is embedded in my controls macro . In order to use my macro as a drill cycle, I have setup a custom cycle (9). This is working perfectly, however, in the tool change area of my post I am wanting to stop the output of the spindle command for drillcyc$ 9 " only ".

OK so from my code below here is what is happening.

If I have drillcyc$9 (my honing cycle) in my operations, I am indeed getting no spindle output which is what I want, however, I am getting no spindle output for any other operations either including a standard 2d contour.

If I am using any other drill cycle I am getting the spindle output as required both in drill cycles and standard contours etc..

I have tried a few things, but I am at a loss now. I can't seem to force the spindle back on if I am using my custom drill cycle.

Thanks in advance for looking at this.

# --------------------------------------------------------------------------
# Start of File and Toolchange Setup
# --------------------------------------------------------------------------
p_goto_strt_tl  #Make the tool start up at toolchange
      pfd_shft_inc
      psign_ang_out

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

      #Unlock rotary axis
      if use_clamp,
        [
        p_lock = zero
        s_lock = zero
        pbld, n$, s_slock, e$
        pbld, n$, s_plock, e$
        ]
      if stagetool <= one, pbld, n$, *t$, "M6", e$

      if n_tpln_mch > m_one, #Toolplane mapping mode
        [
        #Enter your mapping scheme here...
        pg68_map
        pbld, n$, "G43", *tlngno$, *zabs_s, e$
        pbld, n$, *sg00, pwcs, "X0.", "Y0.", *zabs_s, e$
                
        pcan1, pbld, n$, *sgcode, *xabs_s, *yabs_s, *p_out, *s_out, strcantext, e$
        ]
      else, #5 axis and regular mode ( n_tpln_mch = -2)
        [
        if cut_ra_head & use_g45, #Swap xout and yout based on offset axis
          [
          tloffno2 = tlngno$ + g45_of_add
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *yout, *p_out, *s_out,
            *speed, *spindle, pgear, strcantext, e$
          pbld, n$, "G45", *tloffno2, *xout, e$
          ]   
          else, #HONING ONLY
          [
            
        if drillcyc$ = 9, #NO SPINDLE OUT FOR HONING
          [
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *p_out, *s_out,
          *speed, pgear, strcantext, e$
          *sg254, *xout, *yout, e$
          ]
         
          else, #OUTPUT SPINDLE FOR ALL OTHER DRILLCYCLES
          [
                     
        if drillcyc$ <> 9, #OUTPUT SPINDLE FOR ALL OTHER DRILLCYCLES
          [
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *p_out, *s_out,
          *speed, *spindle, pgear, strcantext, e$
          *sg254, *xout, *yout, e$
          ]
        else,
          [
          if opcode$ <> 3, "OUTPUT SPINDLE FOR ALL OTHER TOOLPATH TYPES
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *xout, *yout, *p_out, *s_out,
            *speed, *spindle, pgear, strcantext, e$
          ]
         else,
         [
         
         n$, sg28, "Z66.386", e$
         pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *p_out, *s_out,
         *speed, *spindle, pgear, strcantext, e$
         *sg254, *xout, *yout, e$
         ]
        ]
        ]
        ]
      if stagetool = one, pbld, n$, *next_tool$, e$

      #Lock rotary axis
      if use_clamp & (cuttype = zero | opcode$ = three | opcode$ = 16),
        [
        p_lock = one
        s_lock = one
        pbld, n$, s_slock, e$
        pbld, n$, s_plock, e$
        ]

      if n_tpln_mch > m_one, #Toolplane mapping mode
        [
        #Enter your mapping scheme here...
        pg68
        pbld, n$, *xout, *yout, *zout, pscool, e$
        ]
      else, pbld, n$, "G43", *tlngno$, *zout, pscool, e$
      
     

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

Link to comment
Share on other sites

          if opcode$ <> 3, "OUTPUT SPINDLE FOR ALL OTHER TOOLPATH TYPES
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *xout, *yout, *p_out, *s_out,
            *speed, *spindle, pgear, strcantext, e$
          ]
         else,

You are missing a # sign here.

Why do you have a else after the else? That doesn't look correct condition handling in the post and need to check your If and Else use as it looks like your off on the tracking of your condition statements.

Link to comment
Share on other sites
9 hours ago, 5th Axis CGI said:

Care to expand on that?

Not really, other than the information doesn't appear to be correct...

The post documentation states the following;

"...The difference between drl_cycle$ and drillcyc$ is that when multiaxis drilling is active, MP adds 100 to the value of drillcyc$. This is done to provide backward compatibility for older posts. "

But in my own testing it appears to be the opposite of the above statement.

%
O0000(T)
G20
G0 G17 G40 G49 G80 G90
( 2D DRILLING )
T62 M6
G0 G90 G54 X0. Y0. A0. S2139 M3
G43 H62 Z.1
SOF >>>  drillcyc$ 101.
         drl_cycle$ 1.
G99 G83 Z0. R.1 Q.1 F4.11
G80
M5
G91 G28 Z0.
A0.
M01
( MULTIAXIS DRILLING )
T256 M6
G0 G90 G54 X2.8738 Y0. A90. S2139 M3
G43 H256 Z2.9242
TOOLCHANGE >>>  drillcyc$ 1.
                drl_cycle$ 1.
G98 G83 X0. Z0. R.2496 Q0. F25.
G80
M5
G91 G28 Z0.
G28 X0. Y0. A0.
M30
%

So if it were me, I would use drl_cycle$ rather than drillcyc$. 

And while we're pretending it's me with this issue; I'd check to see what condition my conditions were in.  I'm having a hard time making sense of the below logic.

On 12/16/2018 at 2:51 PM, DRIPPY said:

if drillcyc$ = 9, #NO SPINDLE OUT FOR HONING
          [
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *p_out, *s_out,
          *speed, pgear, strcantext, e$
          *sg254, *xout, *yout, e$
          ]
         
          else, #OUTPUT SPINDLE FOR ALL OTHER DRILLCYCLES
          [
                     
        if drillcyc$ <> 9, #OUTPUT SPINDLE FOR ALL OTHER DRILLCYCLES
          [
          n$, sg28, "Z66.386", e$
          pcan1, pbld, n$, *sgcode, pwcs, *sg254, *sgabsinc, *p_out, *s_out,
          *speed, *spindle, pgear, strcantext, e$
          *sg254, *xout, *yout, e$
          ]

 

  • Like 1
Link to comment
Share on other sites

The code is simply not formatted correctly. Just add a pound sign in front of the 'if drillcyc$ <> 9', or better yet, remove the line of code.

  If (condition is true) , #(here the comma is the "then" statement)

     [ #brace1

       n$, "line1", e$

      n$, "line2", e$

      ] #close brace1, end output of 'if' condition

   else, #must immediately follow if condition, and be 'else,' on it's own line.

    [#brace2

     n$, "else1", e$

     n$, "else2", e$

     ] #end brace2 output

 

Be careful trying to nest multiple if/else statements...

You cannot have multiple "else, else, else" statements, the way you do.  It just doesn't work, as evidenced by your incorrect output. 

 

Link to comment
Share on other sites

Hi All,

Thank you for the tips. I am no expert in post writing. I appreciate the feed back. I will edit my post and give it a go after the Christmas break. We have shut the machines down today for the year.

I wish all of you a Merry Christmas and I will let you all know the outcome.

Cheers

Dave

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