1 NX11+VS2013 2 3 4 #include <uf.h> 5 #include <uf_modl.h> 6 7 8 UF_initialize(); 9 10 //创建块 11 UF_FEATURE_SIGN Sign = UF_NULLSIGN;//设置布尔 12 double Corner_pt[3] = { 0.0, 0.0, 0.0 };//设置原点 13 char *Edge_Len[3] = { "100", "100", "100" };//设置长宽高 14 tag_t BlkTag = NULL_TAG; 15 UF_MODL_create_block1(Sign, Corner_pt, Edge_Len, &BlkTag); 16 17 //特征找体 18 tag_t BodyTag = NULL_TAG; 19 UF_MODL_ask_feat_body(BlkTag, &BodyTag); 20 21 //创建固定的基准平面 22 double Origin_Point[3] = { 0, 0, 0 }; 23 double Plane_Normal[3] = { 0, 1, 0 }; 24 tag_t Plane_Tag = NULL_TAG; 25 UF_MODL_create_fixed_dplane(Origin_Point, Plane_Normal, &Plane_Tag); 26 27 //创建镜像体 28 tag_t MirroredFeature = NULL_TAG; 29 UF_MODL_create_mirror_body(BodyTag, Plane_Tag, &MirroredFeature); 30 31 //特征找体 32 tag_t MirroredBodyTag = NULL_TAG; 33 UF_MODL_ask_feat_body(MirroredFeature, &MirroredBodyTag); 34 35 //求和 36 tag_t FiecEid = NULL_TAG; 37 UF_MODL_unite_bodies_with_retained_options(BodyTag, MirroredBodyTag, false, false, &FiecEid); 38 39 //特征找体 40 tag_t FiecEidBodyTag = NULL_TAG; 41 UF_MODL_ask_feat_body(FiecEid, &FiecEidBodyTag); 42 43 //修剪体 44 tag_t trim_feature = NULL_TAG; 45 UF_MODL_trim_body(FiecEidBodyTag, Plane_Tag, 0, &trim_feature); 46 47 UF_terminate(); 48 49 50 Caesar卢尚宇 51 2019年12月5日