Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Posting error when using a post processor that has been converted from NX10 to NX12

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

@AdamCAM

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

 

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


Re: Posting error when using a post processor that has been converted from NX10 to NX12

Valued Contributor
Valued Contributor

@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! 

Highlighted

Re: Posting error when using a post processor that has been converted from NX10 to NX12

Phenom
Phenom

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
%

Re: Posting error when using a post processor that has been converted from NX10 to NX12

Phenom
Phenom
I missed the detail that you had resaved the post in PB12. At that point all bets are off. I have a siemens post right now that resaving from PB8.5 to PB10 changes about 30% of the code (and post does not work.) If I don't have the time to track down what new problems are - I end up editing tcl or sourcing an overwrite of changes that happen (causing problems.) Always time consuming. Better to just start with a new template in the new PB version and rebuild side to side with old version.
NX12.02
Windows 10 Pro

Learn online





Solution Information