Cancel
Showing results for 
Search instead for 
Did you mean: 

Post Builder for 5-axis Vectors

Creator
Creator

I am currently working on a post for a 5-axis hurco with the Winmax 5 controller. I was informed that the machine works better with vector output over axis output. The I J K is the tool vector and the U V W is the surface normal vector. I been struggling to figure out what the MOM code is for these vectors. This is a swivel head with rotary table mill.

 

X,  Y, Z, B, A = should be X, Y, Z, I, J, K, U, V, W.

 

Thanks, Jim B.

14 REPLIES 14

Re: Post Builder for 5-axis Vectors

Gears Phenom Gears Phenom
Gears Phenom

hi,

dont have experience with that control but

xyz - this is clear

ijk - tool axis vector (mom_tool_axis, array012)

u v w - if this is a contact normal vector it should be used with 3D cutter compensation.

(mom_contact_normal, array012).

(Generated only if 3D cutter compensation is ON and if exists only one single contact point with surface.)

 

So I hope you just need XYZ IJK.

So just create:

- 3 new non-modal addresess for I,J,K ,(IJK addresses exists already for circular move, so use different names),

- new format with at least 7 decimals

- and use mom_tool_axis variable 012

 

 

btw with vector output it doesnt matter the kinematics you have.

aa.jpg

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: Post Builder for 5-axis Vectors

Creator
Creator

Thank you Juraj, I will try using the mom_tool_axis again and see if it will run. The machine errors out stating that the rotation is missing information. The 3D cutter compensation might have something to d owith this as well.

 

Thanks again, Jim B.

Re: Post Builder for 5-axis Vectors

Gears Phenom Gears Phenom
Gears Phenom

ur welcome.

Hard to say.

People are not using 3d cutter compensation always.

It is optional in some operations.

You have probably problem with something else.

Some function is missing to enable vector mode, or something like that..

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: Post Builder for 5-axis Vectors

Creator
Creator

I ma working with SIemens for a solution on this problem. I was told that multiple CNC machines use this vector output. Thanks again for helping me with this.

 

Jim B.

Re: Post Builder for 5-axis Vectors

Legend
Legend

Looks like @Juraj beat me to it, but here is a screenshot from one of my posts. 

 

Also see 2nd pic, try posting after turning on "Output Contact Data." This is for the surface normal vectors. 

 

 

I = $mom_tool_axis(0)

J = $mom_tool_axis(1)

K = $mom_tool_axis(2)

 

 

vector output.PNG

 

contact data.PNG

Glenn Balon
Production: NX 12.0.2 MP5 Primarily CAM

Re: Post Builder for 5-axis Vectors

Siemens Phenom Siemens Phenom
Siemens Phenom

The Hurco documentation concerning plane transformations shows that I,J,K is in relation to the new X vector and U,V,W is in relation to the new Y vector unlike other Fanuc based controls that specify I,J,K as the Z. So in this case, mom_tool_axis(0),(1), and (2) are little help since they point in the new Z vector. The solution requires a couple of matrix transformations from the parent MCS to the final tool axis matrix. I am currently working on jim_1's post solution using Post Configurator, but I would like to share some of the code for those who may also need to transform a CSYS.

 

First, I set some custom global variables that will be used in both a procedure as well as a block template. In the end they will define the vectors for all three axes.

 

set ::rot_3_matrix(0) 0.0
set ::rot_3_matrix(1) 0.0
set ::rot_3_matrix(2) 0.0
set ::rot_3_matrix(3) 0.0
set ::rot_3_matrix(4) 0.0
set ::rot_3_matrix(5) 0.0
set ::rot_3_matrix(6) 0.0
set ::rot_3_matrix(7) 0.0
set ::rot_3_matrix(8) 0.0

 

Next, the rotation angles and original matrix must be captured in a pretreatment procedure. The angles are being collected from the MOM_drill event in this case, but you get the idea.

 

#------------------------------------------------------------
proc LIB_SPF_pt_additional_variables_momvars {} {
#------------------------------------------------------------
LIB_SPF_pretreatment_add_var MOM_drill mom_out_angle_pos
LIB_SPF_pretreatment_add_var MOM_set_csys mom_parent_csys_matrix
}

 

Next, the custom procedure can be made to transform the original matrix to the final tool axis matrix using the collected mom variables.

 

#------------------------------------------------------------
proc hurco_transform_plane {} {
#------------------------------------------------------------
# Define the angles in radians
set rot4 [LIB_SPF_deg_to_rad [LIB_SPF_get_pretreatment mom_out_angle_pos(0)]]
set rot5 [LIB_SPF_deg_to_rad [LIB_SPF_get_pretreatment mom_out_angle_pos(1)]]
set rot6 [LIB_SPF_deg_to_rad 0.0000]
# Define the original matrix
set rot_0_matrix(0) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(0)]
set rot_0_matrix(1) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(1)]
set rot_0_matrix(2) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(2)]
set rot_0_matrix(3) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(3)]
set rot_0_matrix(4) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(4)]
set rot_0_matrix(5) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(5)]
set rot_0_matrix(6) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(6)]
set rot_0_matrix(7) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(7)]
set rot_0_matrix(8) [LIB_SPF_get_pretreatment mom_parent_csys_matrix(8)]
# Matrix for Rotation Around Y Axis
set rot_y_matrix(0) [expr {cos($rot5)}]
set rot_y_matrix(1) 0
set rot_y_matrix(2) [expr {sin($rot5)*(0-1)}]
set rot_y_matrix(3) 0
set rot_y_matrix(4) 1
set rot_y_matrix(5) 0
set rot_y_matrix(6) [expr {sin($rot5)}]
set rot_y_matrix(7) 0
set rot_y_matrix(8) [expr {cos($rot5)}]
# Results of Y rotation
set rot_1_matrix(0) [expr {$rot_y_matrix(0)*$rot_0_matrix(0)+$rot_y_matrix(1)*$rot_0_matrix(3)+$rot_y_matrix(2)*$rot_0_matrix(6)}]
set rot_1_matrix(1) [expr {$rot_y_matrix(0)*$rot_0_matrix(1)+$rot_y_matrix(1)*$rot_0_matrix(4)+$rot_y_matrix(2)*$rot_0_matrix(7)}]
set rot_1_matrix(2) [expr {$rot_y_matrix(0)*$rot_0_matrix(2)+$rot_y_matrix(1)*$rot_0_matrix(5)+$rot_y_matrix(2)*$rot_0_matrix(8)}]
set rot_1_matrix(3) [expr {$rot_y_matrix(3)*$rot_0_matrix(0)+$rot_y_matrix(4)*$rot_0_matrix(3)+$rot_y_matrix(5)*$rot_0_matrix(6)}]
set rot_1_matrix(4) [expr {$rot_y_matrix(3)*$rot_0_matrix(1)+$rot_y_matrix(4)*$rot_0_matrix(4)+$rot_y_matrix(5)*$rot_0_matrix(7)}]
set rot_1_matrix(5) [expr {$rot_y_matrix(3)*$rot_0_matrix(2)+$rot_y_matrix(4)*$rot_0_matrix(5)+$rot_y_matrix(5)*$rot_0_matrix(8)}]
set rot_1_matrix(6) [expr {$rot_y_matrix(6)*$rot_0_matrix(0)+$rot_y_matrix(7)*$rot_0_matrix(3)+$rot_y_matrix(8)*$rot_0_matrix(6)}]
set rot_1_matrix(7) [expr {$rot_y_matrix(6)*$rot_0_matrix(1)+$rot_y_matrix(7)*$rot_0_matrix(4)+$rot_y_matrix(8)*$rot_0_matrix(7)}]
set rot_1_matrix(8) [expr {$rot_y_matrix(6)*$rot_0_matrix(2)+$rot_y_matrix(7)*$rot_0_matrix(5)+$rot_y_matrix(8)*$rot_0_matrix(8)}]
# Matrix for Rotation Around X Axis
set rot_x_matrix(0) 1
set rot_x_matrix(1) 0
set rot_x_matrix(2) 0
set rot_x_matrix(3) 0
set rot_x_matrix(4) [expr {cos($rot4)}]
set rot_x_matrix(5) [expr {sin($rot4)}]
set rot_x_matrix(6) 0
set rot_x_matrix(7) [expr {sin($rot4)*(0-1)}]
set rot_x_matrix(8) [expr {cos($rot4)}]
# Results of X rotation
set rot_2_matrix(0) [expr {$rot_x_matrix(0)*$rot_1_matrix(0)+$rot_x_matrix(1)*$rot_1_matrix(3)+$rot_x_matrix(2)*$rot_1_matrix(6)}]
set rot_2_matrix(1) [expr {$rot_x_matrix(0)*$rot_1_matrix(1)+$rot_x_matrix(1)*$rot_1_matrix(4)+$rot_x_matrix(2)*$rot_1_matrix(7)}]
set rot_2_matrix(2) [expr {$rot_x_matrix(0)*$rot_1_matrix(2)+$rot_x_matrix(1)*$rot_1_matrix(5)+$rot_x_matrix(2)*$rot_1_matrix(8)}]
set rot_2_matrix(3) [expr {$rot_x_matrix(3)*$rot_1_matrix(0)+$rot_x_matrix(4)*$rot_1_matrix(3)+$rot_x_matrix(5)*$rot_1_matrix(6)}]
set rot_2_matrix(4) [expr {$rot_x_matrix(3)*$rot_1_matrix(1)+$rot_x_matrix(4)*$rot_1_matrix(4)+$rot_x_matrix(5)*$rot_1_matrix(7)}]
set rot_2_matrix(5) [expr {$rot_x_matrix(3)*$rot_1_matrix(2)+$rot_x_matrix(4)*$rot_1_matrix(5)+$rot_x_matrix(5)*$rot_1_matrix(8)}]
set rot_2_matrix(6) [expr {$rot_x_matrix(6)*$rot_1_matrix(0)+$rot_x_matrix(7)*$rot_1_matrix(3)+$rot_x_matrix(8)*$rot_1_matrix(6)}]
set rot_2_matrix(7) [expr {$rot_x_matrix(6)*$rot_1_matrix(1)+$rot_x_matrix(7)*$rot_1_matrix(4)+$rot_x_matrix(8)*$rot_1_matrix(7)}]
set rot_2_matrix(8) [expr {$rot_x_matrix(6)*$rot_1_matrix(2)+$rot_x_matrix(7)*$rot_1_matrix(5)+$rot_x_matrix(8)*$rot_1_matrix(8)}]
# Matrix fir Rotation Around Z Axis
set rot_z_matrix(0) [expr {cos($rot6)}]
set rot_z_matrix(1) [expr {sin($rot6)}]
set rot_z_matrix(2) 0
set rot_z_matrix(3) [expr {sin($rot6)*(0-1)}]
set rot_z_matrix(4) [expr {cos($rot6)}]
set rot_z_matrix(5) 0
set rot_z_matrix(6) 0
set rot_z_matrix(7) 0
set rot_z_matrix(8) 1
# Results for final rotation
set ::rot_3_matrix(0) [expr {$rot_z_matrix(0)*$rot_2_matrix(0)+$rot_z_matrix(1)*$rot_2_matrix(3)+$rot_z_matrix(2)*$rot_2_matrix(6)}]
set ::rot_3_matrix(1) [expr {$rot_z_matrix(0)*$rot_2_matrix(1)+$rot_z_matrix(1)*$rot_2_matrix(4)+$rot_z_matrix(2)*$rot_2_matrix(7)}]
set ::rot_3_matrix(2) [expr {$rot_z_matrix(0)*$rot_2_matrix(2)+$rot_z_matrix(1)*$rot_2_matrix(5)+$rot_z_matrix(2)*$rot_2_matrix(8)}]
set ::rot_3_matrix(3) [expr {$rot_z_matrix(3)*$rot_2_matrix(0)+$rot_z_matrix(4)*$rot_2_matrix(3)+$rot_z_matrix(5)*$rot_2_matrix(6)}]
set ::rot_3_matrix(4) [expr {$rot_z_matrix(3)*$rot_2_matrix(1)+$rot_z_matrix(4)*$rot_2_matrix(4)+$rot_z_matrix(5)*$rot_2_matrix(7)}]
set ::rot_3_matrix(5) [expr {$rot_z_matrix(3)*$rot_2_matrix(2)+$rot_z_matrix(4)*$rot_2_matrix(5)+$rot_z_matrix(5)*$rot_2_matrix(8)}]
set ::rot_3_matrix(6) [expr {$rot_z_matrix(6)*$rot_2_matrix(0)+$rot_z_matrix(7)*$rot_2_matrix(3)+$rot_z_matrix(8)*$rot_2_matrix(6)}]
set ::rot_3_matrix(7) [expr {$rot_z_matrix(6)*$rot_2_matrix(1)+$rot_z_matrix(7)*$rot_2_matrix(4)+$rot_z_matrix(8)*$rot_2_matrix(7)}]
set ::rot_3_matrix(8) [expr {$rot_z_matrix(6)*$rot_2_matrix(2)+$rot_z_matrix(7)*$rot_2_matrix(5)+$rot_z_matrix(8)*$rot_2_matrix(8)}]
MOM_do_template hurco_csys_on
}

 

It wasn't actually necessary to include the sixth axis rotation since this is a 5-axis machine, but I put it in there for reuse in case I ever need to use this procedure for a different 6-axis machine (Who knows?). The hurco_csys_on block template will be using rot_3_matrix(0) through rot_3_matrix(5) to define the I,J,K,U,V,W values respectively.

 

Finally, a buffer command is needed to call the procedure into the proper place.

 

LIB_GE_command_buffer_edit_replace LIB_CSYS_plane_output_init CSYS2_ON @OUTPUT1 hurco_transform_plane _HURCOTRANSFORMPLANE

 

Here I am replacing the former G68.2 code with my block template.

 

There's still a few things I am working out in this post, but the G68.2 code was tested and accepted at jim_1's machine tool, so we know the transformation works. We hope this helps others for post creation.

Re: Post Builder for 5-axis Vectors

Siemens Phenom Siemens Phenom
Siemens Phenom

Also, here is a picture of the block template for those who are curious. It's simply a modification of the set_csys_on block template.

Capture08.JPG

Re: Post Builder for 5-axis Vectors

Legend
Legend

@jkane1 I thank you for The Matrix transformations........... You are the ONE!!!!

 

 

matrix.jpg

 

 

Glenn Balon
Production: NX 12.0.2 MP5 Primarily CAM

Re: Post Builder for 5-axis Vectors

Siemens Phenom Siemens Phenom
Siemens Phenom

Thank you for the compliment, but I worked heavily with an NX CAM developer to learn how to do the math. Let's call him RK. RK showed me how to work out the problem and I simply wrote the code.

Learn online





Solution Information