NX obtain secondary development -UFUN edge type UF_MODL_ask_edge_type

 1 NX11+VS2013
 2 
 3 #include <uf.h>
 4 #include <uf_ui.h>
 5 #include <uf_modl.h>
 6 #include <uf_curve.h>
 7 
 8 
 9 UF_initialize();
10 
11 //创建圆柱
12 UF_FEATURE_SIGN Sign = UF_NULLSIGN;
13 double Origin[3] = { 0.0, 0.0, 0.0 };
14 char *Height = "100";
15 char *Diam = "50"; 16 double Direction[3] = { 0.0, 0.0, 1.0 }; 17 tag_t CylTag = NULL_TAG; 18 UF_MODL_create_cyl1(Sign, Origin, Height, Diam, Direction, &CylTag); 19 20 //特征找体 21 tag_t body_tag = NULL_TAG; 22 UF_MODL_ask_feat_body(CylTag, &body_tag); 23 24 // body with an edge 25 uf_list_p_t edge_list; 26 is UF_MODL_ask_body_edges (BODY_TAG, & edge_list); // get the number of the list 27 28 int COUNT = 0 29 ; 30 UF_MODL_ask_list_count (edge_list, & COUNT); 31 is 32 UF_UI_open_listing_window ( ); 33 is for (int I = 0; I <COUNT; I ++ ) 34 is {35 // get the list in each of a 36 tag_t edge_tag = Tag NULL_TAG; 37 [UF_MODL_ask_list_item (edge_list, I, & edge_tag); 39 // 38 is obtained the edge type int edge_type = 0 40 ; 41 is UF_MODL_ask_edge_type (edge_tag, &edge_type); 42 // Edge type: 43 // UF_MODL_LINEAR_EDGE linear edge 44 // UF_MODL_CIRCULAR_EDGE circular edge 45 // UF_MODL_ELLIPTICAL_EDGE ellipse intersects side edge 46 // UF_MODL_INTERSECTION_EDGE 47 // UF_MODL_SPLINE_EDGE spline curve side edges 48 // UF_MODL_SP_CURVE_EDGE @ 49 UF_MODL_FOREIGN_EDGE 52 // UF_MODL_CONVERGENT_EDGE convergent outer side edge 50 // UF_MODL_CONST_PARAMETER_EDGE parameter curve 51 // UF_MODL_TRIMMED_CURVE_EDGE cutting edge 53 side determines whether or rounded edges // iF 54 is (edge_type == UF_MODL_CIRCULAR_EDGE) 55 {// arcuate array 56 is labeled, starting and end angles (measured in radians), arc center coordinates and the radius of the circular arc 57 is UF_CURVE_arc_t arc_coords; 58 UF_CURVE_ask_arc_data (edge_tag, & arc_coords); 59 Double rADIUS = arc_coords.radius; // arc radius 60 tag_t matrix = arc_coords.matrix_tag ; // arcuate matrix 61 double start = arc_coords.start_angle; // arc start angle 62 double end = arc_coords.end_angle; // arcuate end corner 63 double p1 [3]; 64 p1 [0] = arc_coords.arc_center [0]; // arc center coordinates P1 65 [. 1] = arc_coords.arc_center [. 1 ]; 66 P1 [2] = arc_coords.arc_center [2 ]; char 67 68 MSG [256 ]; 69 sprintf_s (MSG, "rounded edge radius:% F" , rADIUS); 70 UF_UI_write_listing_window (MSG); 71 is } 72 73 is } 74 75 UF_terminate (); 76 77 Caesar Lushang Yu 78 November 2019 13th

Guess you like

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