cancel
Showing results for 
Search instead for 
Did you mean: 

Why does PB_CMD_init_helix work?

Valued Contributor
Valued Contributor

I am working on a mill post and was testing a few things. I found that on a helix move my post outputted a bunch of interpolated XYZ moves. I tested a 3 axis mill and found that it does output a spiral move. I investigated it and found the command PB_CMD_init_helix at the start . I copied and pasted it into my post and now it outputs a circular move. My question is how can it do this? I didn't notice anything in the code saying to replace any interpolated moves or to even do the proc or command.

 

#=============================================================
proc PB_CMD_init_helix { } {
#=============================================================
uplevel #0 {
#
# This procedure will be executed automatically at the start of program and
# anytime it is loaded as a slave post of a linked post.
#
# This procedure can be used to enable your post to output helix.
# You can choose from the following options to format the circle
# block template to output the helix parameters.
#

set mom_sys_helix_pitch_type	"rise_radian"

#
# The default setting for mom_sys_helix_pitch_type is "rise_radian".
# This is the most common.  Other choices are:
#
#    "rise_radian"              Measures the rise over one radian.
#    "rise_revolution"          Measures the rise over 360 degrees.
#    "none"                     Will suppress the output of pitch.
#    "other"                    Allows you to calculate the pitch
#                               using your own formula.
#
# This custom command uses the block template circular_move to output
# the helix block.  If your post uses a block template with a different
# name, you must edit the line that outputs the helix block.

#
#  The following variable deines the output mode for helical records.
#
#  FULL_CIRCLE  -- This mode will output a helix record for each 360
#                  degrees of the helix.
#  QUADRANT  --    This mode will output a helix record for each 90
#                  degrees of the helix.
#  LINEAR  --      This mode will output the entire helix as linear gotos.
#  END_POINT --    This mode will assume the control can define an entire
#                  helix in a single block.

   set mom_kin_helical_arc_output_mode FULL_CIRCLE

   MOM_reload_kinematics



#=============================================================
proc MOM_helix_move { } {
#=============================================================
   global mom_pos_arc_plane
   global mom_sys_cir_vector
   global mom_sys_helix_pitch_type
   global mom_helix_pitch
   global mom_prev_pos mom_pos_arc_center
   global PI

   switch $mom_pos_arc_plane {
      XY { MOM_suppress once K ; set cir_index 2 }
      YZ { MOM_suppress once I ; set cir_index 0 }
      ZX { MOM_suppress once J ; set cir_index 1 }
   }

   switch $mom_sys_helix_pitch_type {
      none { }
      rise_revolution { set pitch $mom_helix_pitch }
      rise_radian { set pitch [expr $mom_helix_pitch / ($PI * 2.0)]}
      other {
#
#	Place your custom helix pitch code here
#
      }
      default { set mom_sys_helix_pitch_type "none" }
   }

   MOM_force once X Y Z

   if {$mom_sys_helix_pitch_type != "none"} {
      MOM_force once I J K
      if {$mom_sys_cir_vector == "Vector - Arc Center to Start"} {
         set mom_prev_pos($cir_index) 0.0
         set mom_pos_arc_center($cir_index) $pitch
      } elseif {$mom_sys_cir_vector == "Vector - Arc Start to Center"} {
         set mom_prev_pos($cir_index) $pitch
         set mom_pos_arc_center($cir_index) 0.0
      } elseif {$mom_sys_cir_vector == "Unsigned Vector - Arc Center to Start"} {
         set mom_prev_pos($cir_index) 0.0
         set mom_pos_arc_center($cir_index) $pitch
      } elseif {$mom_sys_cir_vector == "Absolute Arc Center"} {
         set mom_pos_arc_center($cir_index) $pitch
      }
   }


#
# You may need to edit this line if you output more than one block
# or if you have changed the name of your circular_move block template
#
   MOM_do_template circular_move


} ;# MOM_helix_move


} ;# uplevel
}
Using NX 8.0.3.4
6 REPLIES

Re: Why does PB_CMD_init_helix work?

Phenom
Phenom

It is called by "PB_CMD_kin_start_of_program" which is called by "PB_start_of_program" - both of which are written by postbuilder. Then this routine uplevels a MOM_helix_move routine that NX will call. The following instructs NX to output circles:

 

   set mom_kin_helical_arc_output_mode FULL_CIRCLE

   MOM_reload_kinematics

 

NX10.03
Windows 7 Pro

Re: Why does PB_CMD_init_helix work?

Valued Contributor
Valued Contributor

So basicly there is a routine in post builder that already handles a helix move, but I guess just interpolates them. It doesn't output a circular move until it is replaced by something that gives the command.

Using NX 8.0.3.4

Re: Why does PB_CMD_init_helix work?

When you create a new mill post in Post Builder, PB_CMD_init_helix should be there.

All you need to do is set the pitch type and output mode if you don't want the defaults.

Mark Rief
Retired Siemens

Re: Why does PB_CMD_init_helix work?

Phenom
Phenom

Without the kin variable set - NX would send points to the post - and the post wouldn't know that it is a helix at all. The kin variable makes NX issue helical circles and call MOM_helix_move.

NX10.03
Windows 7 Pro

Re: Why does PB_CMD_init_helix work?

Valued Contributor
Valued Contributor

Thanks Study I think I got a good understanding of it, at least enough to use it.

 

Mark, a new post does have the helix command which I copied, but the mill turn post I started from didn't. Just wanted to get an understanding of how it worked before I use it.

Using NX 8.0.3.4

Re: Why does PB_CMD_init_helix work?

Esteemed Contributor
Esteemed Contributor

The way it is set up (or at least the way I interpret it), is that if the indicated proc exists, it is called, and the post outputs helical moves as specified.  If it doesn't exist, NX outputs linear moves to interpolate the helix at the specified tolerance.

 

So for older posts, if you want helical output, you have to add it (import the custom command)

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Learn online





Solution Information