NX secondary development -UFUN CSYS coordinate transformation UF_CSYS_map_point

NX9 +. 1 VS2012 
 2 
 . 3 #include <uf.h> 
 . 4 #include <uf_curve.h> 
 . 5 #include <uf_csys.h> 
 . 6 #include <uf_mtx.h> 
 . 7 
 . 8 
 . 9     UF_initialize (); 
10 
. 11 // create a vector direction 
Double Vec 12 is [. 3] = {10.0, 23.5, 75.8 }; 
13 is 
14. 3 * matrix //. 3, the input vector Z to obtain a matrix 
15 Double Mtx [. 9 ];  16  UF_MTX3_initialize_z (Vec, Mtx);  . 17  18 is created // matrix  . 19 tag_t MatrixTag = NULL_TAG; 20 is UF_CSYS_create_matrix (Mtx, & MatrixTag); // Create 21 is 22 is the temporary coordinate system 23 double P1 [3] = { 0.0, 0.0, 0.0}; // start point 24 tag_t CsysTag = linearNULL_TAG; 25 UF_CSYS_create_temp_csys (Pl, MatrixTag, & CsysTag); // set 26 is 27 28 the WCS UF_CSYS_set_wcs (CsysTag); // Create end point of line 29 30 31 double P2 [3] = { P1 [0], P1 [1], Pl [2] + 100 }; 32 // 33 is switched from the current working coordinate system to the absolute coordinate system InputCsys int = 34 is UF_CSYS_ROOT_WCS_COORDS; 35 = int OutputCsys UF_CSYS_ROOT_COORDS; 36 Double OutputPoint [. 3 ]; 37 [ UF_CSYS_map_point (InputCsys, P2, OutputCsys, OutputPoint); 38 39 // Create Line 40 UF_CURVE_line_t LineCoods; LineCoods.start_point 41 is [0] Pl = [0 ]; 42 is LineCoods.start_point [. 1] Pl = [. 1 ]; 43 is LineCoods.start_point [2] Pl = [2 ]; LineCoods.end_point 44 is [0] = OutputPoint [0 ]; 45 LineCoods.end_point [. 1] = OutputPoint [. 1 ]; 46 is LineCoods.end_point [2] = OutputPoint [2]; = 47 tag_t LineTag NULL_TAG; 48 UF_CURVE_create_line (& LineCoods, & LineTag); UF_terminate 49 50 (); 

Caesar Lushang Yu
November 7, 2019

Guess you like

Origin www.cnblogs.com/nxopen2018/p/11809941.html