NX二次開発は、曲線UF_CURVE_ask_proj_curvesの曲線を予測ます-UFUN

  1 NX11 + VS2013 
  2 
  3の#include <uf.h> 
  4の#include <uf_modl.h> 
  5の#include <uf_curve.h> 
  6の#include <uf_obj.h> 
  7 
  8 
  9 
 10      
 11 UF_initialize(); 
 12 
 13 //创建四条直线
 14 UF_CURVE_line_t Line_coords1。
 15 Line_coords1.start_point [0] = 0.0  16 Line_coords1.start_point [1] = 0.0  17 Line_coords1.start_point [2] = 0.0 18 Line_coords1.end_point [0] = 10.0 19 Line_coords1.end_point [1] = 0.0 20 Line_coords1.end_point [2] = 0.0 21 tag_t LineTag [4 ]。22 UF_CURVE_create_line(&Line_coords1、&LineTag [0]); 23 24 UF_CURVE_line_t Line_coords2。25 Line_coords2.start_point [0] = 10.0 26 Line_coords2.start_point [1] = 0.0 27 Line_coords2.start_point [2] = 0.0 28 Line_coords2.end_point [0] = 10.0 29 Line_coords2.end_point [1] = 10.0 30 Line_coords2.end_point [2] = 0.0 31 UF_CURVE_create_line(&Line_coords2、&LineTag [1 ])。32 33 UF_CURVE_line_t Line_coords3。34 Line_coords3.start_point [0] = 10.0 35 Line_coords3.start_point [1] = 10.0 36 Line_coords3.start_point [2] = 0.0 37 Line_coords3.end_point [0] = 0.0 38 Line_coords3.end_point [1] = 10.0 39 Line_coords3.end_point [2] = 0.0 40 UF_CURVE_create_line(&Line_coords3、&LineTag [2 ])。41 42Line_coords4 UF_CURVE_line_t; Line_coords4.start_point 43 [0] = 0.0 ; 44 Line_coords4.start_point = 10.0 [1] ; 45 Line_coords4.start_point [2] = 0.0 ; 46 Line_coords4.end_point [0] = 0.0 [1] 47 Line_coords4.end_point 0.0 = 48 Line_coords4.end_point [2] = 0.0 ; 49 UF_CURVE_create_line(&Line_coords4、&LineTag [3 ]); //作成部51 50 52 UF_FEATURE_SIGNサイン= UF_NULLSIGNある; //ブール53ダブルCorner_ptを設定する[3] = { -50.0 、-50.0、-110.0}; //原点54文字を設定* Edge_Len [3] = { "100"、 "100"、 "100"}; // セットtag_t BlkTag = LWH 55 NULL_TAG; 56 UF_MODL_create_block1ある(サイン、Corner_pt、Edge_Len、&BlkTag);表面57を見ていることを特徴と58 // 59でfaceList uf_list_p_t 60 UF_MODL_ask_feat_faces(BlkTag、&faceList)。61 62 // = 0数63 int型の数のリストを取得します; 64 UF_MODL_ask_list_count(faceList、&COUNT); 65 = 66 tag_t redFaceTag NULL_TAG; 67(I = 0 INT; I <COUNT; I ++用)68 {69 //取得各連結リスト70 tag_t faceTag =タグNULL_TAG; 71ですUF_MODL_ask_list_item(faceList、I、&faceTag); 72 // 73で各面74の取得int型の起源タイプ; [3 75ダブルポイント]; 76ダブルディレクトリ[3 ]; 77ダブルボックス[6 ]; 78のダブル半径[3 ]; 79ダブルRadData [3 ]; 80 INT NormDir; 81 UF_MODL_ask_face_data(faceTag、&タイプ、ポイント、ディレクトリ、ボックス、RADIUS、RadData、&NormDir);表面8283 //距離10(ブロックの上面)を見つけます84 IF(FABS(FABS(ポイント[2]) - 10)<0.001 )85 {86 //色UF_OBJ_set_color 87(faceTag、186に設定); 88 redFaceTag = faceTag; 89 } 90} //曲線91 92 93リスト94を作成uf_list_p_t curve_refs; 95 UF_MODL_create_list(&curve_refsする); 96 // 97リストにオブジェクトを追加uf_list_p_t face1_refsに、98(INT I = 0; I <4; I ++ )99 {100 UF_MODL_put_list_item (curve_refs、LineTag [I]); 101 } 102 103 //表面UF_MODL_create_listリストを作成する104(&face1_refs); 105 UF_MODL_put_list_item(face1_refs、redFaceTag); 106 107 108 //投影曲線を作成し109 INTのalong_face = 0; // 0投影ベクトル=(proj_vector)、1 =表面法線110二重proj_vectorを使用を使用して、[3] = { 0.0、0.0、-1.0}; //投影ベクトル方向tag_tのproj1tag = 111 NULL_TAG; 112 UF_MODL_create_proj_curves(curve_refs、face1_refs、along_face 、proj_vector、&proj1tag); // 114 115 113 //グラフ117に投影曲線1116の方法を取得uf_list_p_t uf_curve_refs; 1 18 UF_MODL_ask_proj_curves(proj1tag、&uf_curve_refs); 119 120 // curveCount INT = 0 121の数のリストを取得し、122 UF_MODL_ask_list_count(uf_curve_refs、&curveCount); I = 0(INT 123 124; I <curveCount; I ++ )125 で取得された{126 //リストは各tag_t curveTag = 127タグNULL_TAG; 128 UF_MODL_ask_list_item(uf_curve_refs、I、&curveTagを); //色を設定129 130 UF_OBJ_set_color 131(curveTag、136である); 132 } 133 134方法//// 2 135 // INT n_curve_refs = 0; 136 // tag_t * curve_refsTag = 140 // {141 //(; I <n_curve_refs I ++ INTがI = 0)138 139; // NULL_TAG; 137 // UF_CURVE_ask_proj_curves(proj1tag、&n_curve_refs、&curve_refsTag) セットカラー142 // UF_OBJ_set_color(curve_refsTag [I] 、136); // 143} 144 145 // リストUF_MODL_delete_list 146(&削除uf_curve_refs); UF_MODL_delete_list 147(&curve_refs); 148 UF_MODL_delete_list(&face1_refs)。149 UF_MODL_delete_list(&faceList)。150 151 UF_terminate()。152 153 シーザー卢尚宇154 2020年2月29日

おすすめ

転載: www.cnblogs.com/nxopen2018/p/12387306.html