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:

Swap axis label


Recommended Posts

Machine Def is not hooked up to the Post by default. You've got to add code to get the address label from the Machine Def, and that is a lot of work.

 

Is this a Boring Mill? I usually just hook up a Misc Integer to switch between W and Z output. It usually depends on what you are trying to accomplish, and how you want to drive the machine.

 

On a typical 4 Axis machine, you can just use the "zabs" variable for positioning. I usually create a "user defined" variable to capture the "current Z value", so we can restore it whenever the W Axis is returned to W0. In order to save some coding an aggravation, I then just "swap" the 'prefix' value for 'zabs'.

      
      
      sav_zabs = zabs             #save current Z position
      result = nwadrs("W", zabs)  #change 'zabs' to 'W' output
      .
      .
      .
      #restore Z
      zabs = sav_zabs
      result = nwadrs("Z", zabs)
Link to comment
Share on other sites

I have searched but to no avail. I know this should be easy Colin, I have done it numerous times but seem to be forgetful. I need to change primary "A" axis to "B" and "B" to "A". And make "B" which is rotating about X Axis toward operator (negative).

 

Geesh I wish my memory was better.

 

I was able to limit the axis output to prevent winding up.

 

Thanks for your help in advance.

Link to comment
Share on other sites

That logic looks close, I'll clean it up a bit for you. The question of "where" to put it in the post really depends on how you want to output and control the W Axis. Some of the positioning you will want to do in "Z" to move the machine column into position. Then, you'll want to output the W coordinates, do your cutting (may or may not include adjusting the W position during the tool path), then retract W, and eventually return control to the Z axis.

 

And, of course, you'll have to take into account how you want to do a Tool Change.

 

For example, do you just want to position in Z, then machine in W, and then retract W to "zero", and perform a Tool Change right there? (without moving Z?) Or do you want to position in Z, machine in W, retract W, then retract or re-position Z, and then perform a Tool Change?

 

Your best bet would be to output a couple of (simple) operations, then hand-edit the code, and post it here so I can take a look (make sure you use the "Code" option in the reply for readability!).

 

Here is your cleaned up code:

 

Near the top of the post, after the "General Output Settings", you'll need to initialize some variables:

sav_zabs   : 0 #Saved Z abs value
w_flag     : 0 #Flag to track W mode

I would put this in 'psof$', and also in 'ptlchg$', but be sure you put it AFTER the main position output (let it output XYZ coordinate, Work Offset, start up, and Tool Length Comp (G43) codes).

      if mi3$ = 0, #Z output mode only
        [
        result = nwadrs("Z", zabs]
        w_flag = zero #set tracking flag
        ]
      else, #W output mode
        [
        sav_zabs = zabs
        result = nwadrs("W", zabs)
        w_flag = one #Set tracking flag
        ]

OK, you'll also need to "restore" the Z position for the "next tool change". I would do this in 'pretract':

pretract        #End of tool path, toolchange
      sav_absinc = absinc$
      absinc$ = one
      sav_coolant = coolant$
      coolant$ = zero

#      if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless
        [                 #  explicitely turned off through a canned text edit
        if all_cool_off,
          [
          #all coolant off with a single off code here
          if coolant_on, pbld, n$, sall_cool_off, e$
          coolant_on = zero
          ]
        else,
          [
          local_int = zero
          coolantx = zero
          while local_int < 20 & coolant_on > 0,
            [
            coolantx = and(2^local_int, coolant_on)
            local_int = local_int + one
            if coolantx > zero,
              [
              coolantx = local_int
              pbld, n$, scoolantx, e$
              ]
            coolantx = zero
            ]
          coolant_on = zero
          ]
        ]
      #cc_pos is reset in the toolchange here
      cc_pos$ = zero
      gcode$ = zero
      #   W Mode tracking reset
      if w_flag,
        [
        pbld, n$, sgcode, "W0.", e$ #Return W to home
        zabs = sav_zabs #Restore Z position
        w_flag = zero
        ]
      pbld, n$, sccomp, *sm05, psub_end_mny, e$
      pbld, n$, sgabsinc, sgcode, *sg28ref, "Z0.", scoolant, e$
      if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$
      else, pbld, n$, protretinc, e$
      absinc$ = sav_absinc
      coolant$ = sav_coolant

In 'pretract', we normally output "G91 G28 Z0." to return the spindle home. You may want to modify that, if all you want to do is retract the W Axis for the Tool Change to proceed.

 

Again, a lot of this will depend on what you want/need the code to look like for your machine. Post up a hand-edited sample...

Link to comment
Share on other sites

I have searched but to no avail. I know this should be easy Colin, I have done it numerous times but seem to be forgetful. I need to change primary "A" axis to "B" and "B" to "A". And make "B" which is rotating about X Axis toward operator (negative).

 

Geesh I wish my memory was better.

 

I was able to limit the axis output to prevent winding up.

 

Thanks for your help in advance.

 

 

Hi Bill,

 

Please post up a new thread, so I can help you there... This one is about a Horizontal Boring Mill with a W-Axis...

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