Sign in to follow this  
PMDc

Axis Combination

Recommended Posts

Can I read the axis combinations into the post? 

What I need is when the 3 axis combination is selected the A (4th axis) is omitted and when the 4 axis combination is selected it outputs an A. As it works now I don't get an A move on a 4 axis combination path when the tool plane is equal to TOP.  I tried duplicating the TOP plane but no Bueno. 

My thought is to read these in and set a switch for pfcout.

Axis Combinations.JPG

Share this post


Link to post
Share on other sites

Yes, you can read the axis combination; what version of Mastercam are you using?

Share this post


Link to post
Share on other sites

Look up the acomboinfo function in the MP documentation, it will do what you need.

Share this post


Link to post
Share on other sites

My MP Documentation is Version 9.1 which I think was for X6. I'll ask my reseller again. The last time I asked Shopware for the updated documentation I received no response. Yeah, fun times. 

Thanks for the information. I'll let you know what I find out. 

Share this post


Link to post
Share on other sites

Are you using MPMaster?

Axis combos already output Rotary components, or not, based on the selected Axis Combination. 

There is other code in MPMaster which suppresses the rotary. 

Look for 'sav_rot_on_x'. Spelling might be different. There is a line you must comment out to get the A0. output on the Top/Top plane.

Share this post


Link to post
Share on other sites

Try Generic Fanuc 4X Mill or Generic Haas 4X Mill Post. Both of those should recognize  a 3X or 4X Axis Combo.

Share this post


Link to post
Share on other sites
On 1/3/2020 at 4:27 PM, Colin Gilchrist said:

Are you using MPMaster?

Axis combos already output Rotary components, or not, based on the selected Axis Combination. 

There is other code in MPMaster which suppresses the rotary. 

Look for 'sav_rot_on_x'. Spelling might be different. There is a line you must comment out to get the A0. output on the Top/Top plane.

I'm using MPMaster. 

If I understand what you are saying, the MPMaster should already output what I need. My issue is that when using the 4-axis combination in the TOP plane it omits the "A0" but outputs non-zero rotations correctly.  

Hmmm

Share this post


Link to post
Share on other sites
33 minutes ago, PMDc said:

I'm using MPMaster. 

If I understand what you are saying, the MPMaster should already output what I need. My issue is that when using the 4-axis combination in the TOP plane it omits the "A0" but outputs non-zero rotations correctly.  

Hmmm

Yes, that is correct. Now that I'm not on a phone, give me like, 2 minutes to find it...

Ok, it took me about 30 seconds. 2 minutes was a stretch anyway.

There is a mechanism in the "Tool Table", which checks to see if there is a rotary detected. The mechanism 'earlier' in the Post has set the 'vmc' switch. But the logic in 'pwrtt$' also tests to see "is the rotary set".

Honestly, the logic here really sucks, and could use an overhaul.

# --------------------------------------------------------------------------
# Tooltable Output
# --------------------------------------------------------------------------
pwrtt$      # Write tool table, scans entire file, null tools are negative
           if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,
             [
             sav_rot_on_x = rot_on_x
             output_z = no$
             ]
           if vmc = 0 & tlplnno$ <> 2, sav_rot_on_x = rot_on_x
           if vmc = 1 & tlplnno$ > 1, sav_rot_on_x = rot_on_x
           #sav_rot_on_x = rot_on_x    #Uncomment this line to output rotary axis value even when it's not used

The problem is, if you "uncomment" that line in PWRTT, it will basically "force" the post to always output the Rotary.

I like the way that the 'Generic Fanuc' and 'Generic Haas' Posts do this. They read the components, to detect if a 'Rotary Component' is present in the Axis Combination.

With 'MPMaster', they are testing the 'tlplnno$' variable, to see if any of your Toolplanes are rotated from "Top" (when vertical), or "Front" (when horizontal), and only forcing out the 'Rotary Address', when the plane doesn't match the "initial plane" for a particular machine configuration. (either top or front, always).

Here is how they do it in the Generic Fanuc style Posts:

# --------------------------------------------------------------------------
pset_mach       #Set post switches by reading machine def parameters
      rot_ax_cnt = 0
      rotaxerror = 0
      rot_axis = 0  #Turn off rotary axis unless it is detected in machine read - supresses rotary output in 3 axis machines
      #maxfeedpm = 999999       #Uncomment these variables to force use of machine def values as initial lowest max feedrate value
      #maxfeedpm_m = 9999999    #Otherwise the default (post) initialization setting is used as initial value
      !maxfeedpm, !maxfeedpm_m

      rd_mch_ent_no$ = syncaxis$  #Retrieve machine parameters based on current axis combination - read from .nci G950 line
      if read_md = yes$, rd_md$   #Read machine definition parameters - calls pmachineinfo$

      #We only need these set at toolchange (and start of file).  No need to set them each time a user may call rd_md
      if read_md = yes$, #Override initial post values if reading Machine Definition
        [
        rot_on_x = rot_axis
        rot_ccw_pos = rot_dir
        index = rot_index
        if rot_angle = zero, ctable = one #ctable zero will produce a divide by zero error, so force to one if zero in MD
        else, ctable = rot_angle
        if not(vmc) & rot_on_x = 3, rot_on_x = 2 #If HMC and rotating about world Z axis (machine Y axis)
        ]
      else, rot_index = sav_index

      if met_tool$ = 1,
        [
        maxfrinv = maxfrinv_m   #Set limit for feed inverse time
        maxfeedpm = maxfeedpm_m #Set limit for feed in mm/min
        ]
      sav_srot_label = srot_label #Backup the original rotary axis label

# --------------------------------------------------------------------------
# Machine definition and control definition parameter capture:
# --------------------------------------------------------------------------
pmachineinfo$   #Machine information parameters postblock
      #rd_md is used to call pmachineinfo postblock and read the parameters of the selected axis
      #combination machine entity set in rd_mch_ent_no
      #rd_cd is used to call pmachineinfo postblock and read the active control definition parameters
      #rd_tlpathgrp is used to call pmachineinfo postblock and read the active toolpath group parameters
      #"-->pmachineinfo", ~prmcode$, "  ", ~sparameter$, e$  #Do not uncomment if being called from pprep$ - see pprep comment

      #Read parameter lookup tables -
      if prmcode$ >= 17000 & prmcode$ < 18000, result = fprm(17000) #Run the parameter table for Machine Definition Parameters
      if prmcode$ >= 18000 & prmcode$ < 19000, result = fprm(18000) #Run the parameter table for Control Definition Parameters
      #Leave line below commented until you enter values in related lookup tables
      #if prmcode$ >= 19000 & prmcode$ < 19900, result = fprm(19000) #Run the parameter table for Toolpath Group Parameters

      #Count rotary axis and output error message if more than one is found in the active axis combination and read_md = yes$
      if prmcode$ = 19958,
        [
        component_type = rpar(sparameter$, 1)  #Component type
        if component_type = 5 & read_md = yes$,
          [
          rot_ax_cnt = rot_ax_cnt + 1  #Rotary component
          if rot_ax_cnt = 2, rotaxerror = rotaxerror + 1   #Post only supports 1 rotary per axis combination
          ]
        ]

      #Determine Z direction - set vmc
      if prmcode$ = 17392 & axis_label = 3,
        [
        z_dir = rpar(sparameter$, 1)  #Z axis direction - +X=1,+Y=2,+Z=3,-X=7,-Y=8,-Z=9
        if z_dir <> 3 & z_dir <> 9, vmc = 0   #0 = Horizontal Machine, 1 = Vertical Mill
        else, vmc = 1
        ]

      #Set axis of rotation for rotary component
      if prmcode$ = 17399,
        [
        rot_axis = rpar(sparameter$, 1)  #Axis of rotation - +X=1,+Y=2,+Z=3,-X=7,-Y=8,-Z=9
        if rot_axis > 3, rot_axis = rot_axis - 6 #Keep value positive (+X,+Y,+Z) for use in rot_on_x
        ]
      #Read Linear Axis parameters - capture lowest feedrate value of all linear axis
      if maxfeedpm > prv_maxfeedpm, maxfeedpm = prv_maxfeedpm
      if maxfeedpm_m > prv_maxfeedpm_m, maxfeedpm_m = prv_maxfeedpm_m
      !maxfeedpm, !maxfeedpm_m

In the "Generic Fanuc" style posts, when we see the 'rd_md$' switch, this kicks off the process of running through every single Machine Parameter. This is called "dumping" the parameters, and for every single "machine parameter number" (17,000-17,999), we will then call 'pmachineinfo$' in a loop. During this loop, there is a test, which runs the Parameter Table function. This means that as we "process all the machine parameters", the following 'data structure' gets filled with data:

# --------------------------------------------------------------------------
# Machine Definition Parameters
fprmtbl 17000   14   #Table Number, Size
#       Param   Variable to load value into
        17391   axis_label   #Axis label - 1=X,2=Y,3=Z
        17397   srot_label   #Rotary Axis label (Generally A, B or C) - Not yet available.
        17401   rot_zero     #Rotary zero degree position
        17402   rot_dir      #Rotary direction
        17408   rot_index    #Index or continuous
        17409   rot_angle    #Index step
        17410   rot_type     #Rotary type
        17605   min_speed    #Minimum spindle speed
        17058   maxfrinv     #Maximum feedrate - inverse time - inch - Minimum value from MD as this is inverse time
        17066   maxfrinv_m   #Maximum feedrate - inverse time - metric - Minimum value from MD as this is inverse time
        17992   maxfrdeg     #Maximum feedrate deg/min
        17055   maxfeedpm    #Limit for feed in inch/min
        17063   maxfeedpm_m  #Limit for feed in mm/min
        17101   all_cool_off #First coolant off command shuts off ALL coolant options

So, at the end of the 'pset_mach' loop, we end up with a list of variables, that have "been set by the Machine Parameters".

How do we know if there is a "rotary" at all?

At the beginning of 'pset_mach', we have this line:

      rot_axis = 0  #Turn off rotary axis unless it is detected in machine read - supresses rotary output in 3 axis machines

So, the variable already gets set to '0' at the start of the processing. Later on in the loop, we encounter the following:

      #We only need these set at toolchange (and start of file).  No need to set them each time a user may call rd_md
      if read_md = yes$, #Override initial post values if reading Machine Definition
        [
        rot_on_x = rot_axis
        rot_ccw_pos = rot_dir
        index = rot_index
        if rot_angle = zero, ctable = one #ctable zero will produce a divide by zero error, so force to one if zero in MD
        else, ctable = rot_angle
        if not(vmc) & rot_on_x = 3, rot_on_x = 2 #If HMC and rotating about world Z axis (machine Y axis)
        ]
      else, rot_index = sav_index

This tests the "read_md" variable. If 'read_md' was enabled earlier in the Post, then 'rot_on_x' is set equal to 'rot_axis'.

Where does 'rot_axis' actually get 'enabled' though?

This is at the bottom of 'pmachineinfo$':

      #Set axis of rotation for rotary component
      if prmcode$ = 17399,
        [
        rot_axis = rpar(sparameter$, 1)  #Axis of rotation - +X=1,+Y=2,+Z=3,-X=7,-Y=8,-Z=9
        if rot_axis > 3, rot_axis = rot_axis - 6 #Keep value positive (+X,+Y,+Z) for use in rot_on_x
        ]

That is the actual "test" for "is there a rotary component included in my Machine Parameters". Notice that we set the 'rot_axis' value to either 1, 2, or 3, depending on if we rotate around X, Y, or Z. Notice there is also code to capture "+X", "+Y", and "+Z" directions. Since those values are 7, 8, and 9, we subtract 6 from the result if the value is "greater than 3". (This keeps the values, 1, 2, or 3, for any X, Y, or Z direction (+ or -)).

 

  • Thanks 1
  • Like 6

Share this post


Link to post
Share on other sites

Thank you very much Colin! I will study all of this and get my post dialed in. 

I can't tell you how much I appreciate the education you just provided!

  • Thanks 1
  • Like 1

Share this post


Link to post
Share on other sites

Uncommenting the pwrtt$ line did the trick. Thanks!

  • Like 3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 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