10-30-2018 06:35 PM
Note there are *2* places in your proc that you should include @Juraj's fix:
#============================================================= proc PB_CMD_OUTPUT_rotations { } { #============================================================= # TM. Proc designed to check mom var settings and own angle settings global mom_init_pos global mom_init_alt_pos global mom_out_angle_pos global mom_prev_out_angle_pos global rs_Rots global mom_kin_coordinate_system_type if { $mom_kin_coordinate_system_type == "CSYS" } { if {[info exists mom_init_pos ] && $mom_init_pos(3) > 0.0 } { set rs_Rots(0) [expr $mom_init_pos(3) - 360.0] set rs_Rots(1) [expr $mom_init_pos(4) - 360.0] # Fix next line if { [EQ_is_equal [expr abs($rs_Rots(1))] 360.0] } { set rs_Rots(1) 0.0 } } } elseif { $mom_kin_coordinate_system_type == "LOCAL" } { if {[info exists mom_out_angle_pos ] } { set rs_Rots(0) $mom_out_angle_pos(0) set rs_Rots(1) $mom_out_angle_pos(1) # Fix next line if { [EQ_is_equal [expr abs($rs_Rots(1))] 360.0] } { set rs_Rots(1) 0.0 } } } MOM_force Once G_motion fourth_axis fifth_axis }
If that doesn't fix it, I would add some "MOM_output_text" commands to *both* implementations of EQ_is_equal
- one to say which tcl file it is in
- others to output all the input data
To see which is the "problem" code, and what data is being passed in.
Another thing I've seen is that "EQ_is_equal" is too sensitive for things I consider equal, when it comes to angles.
You can either pass a looser tolerance in, or something like this (2 places in your code):
set rs_Rots(1) [format "%.4f" [expr $mom_init_pos(4) - 360.0]]
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
10-31-2018 03:33 AM
@Ken_A thank you for pointing out that Juraj's fix was required in 2 places! I was rushing around yesterday trying to get a few things done and missed it! That seems to have sorted it!
@Juraj apologies, your suggestion of the code change has fixed my issue - thank you!
Any ideas why the original code worked for postbuilder version 10? Could it be due to a TCL version change as @Study suggested?
Thank you all for your help!
10-31-2018 05:12 AM
Older Postbuilder posts had procs defined for proc EQ_is_zero and proc EQ_is_equal after sourcing in the ugpost_base.tcl and ugpost_base_math.tcl files, these override the newer definitions.
In NX12 these proc's are removed by Postbuilder and the ones in the ugpost_??.tcl files become active.
The new definitions allow you to pass in a specific tol value or it will default to $mom_system_tolerance if you dont.
Here is a quick test using tclsh
% set mom_system_tolerance 0.0000001
0.0000001
% proc EQ_is_zero [list s [list tol $mom_system_tolerance]] {
expr { abs($s) <= $tol }
}
%
% proc EQ_is_equal [list s t [list tol $mom_system_tolerance]] {
expr { abs($s - $t) <= $tol }
}
% EQ_is_zero 0
1
% EQ_is_zero 0.0000001
1
% EQ_is_zero 0.00000001
1
% EQ_is_zero 0.00001
0
% EQ_is_zero 0.000001
0
% EQ_is_zero 0.1 1
1
% EQ_is_zero 0.1 0.1
1
% EQ_is_zero 0.1 0.01
0
%
10-31-2018 09:37 AM