admin 发表于 2013-11-27 14:02:41

NX二次开发-关于body,feature,face,edge 之间的访问源码分享


NX二次开发-关于body,feature,face,edge 之间的访问源码分享

也有创建孔,创建阵列的测试哦!


<p>static void do_ugopenApi(void)
{
//create a block
double coner={0,0,0};
char *edge = {"100","60","40"};
tag_t blk_tag;
UF_MODL_create_block1(UF_NULLSIGN,coner,edge,&blk_tag);
//create a blend start
    char *radius = "20";
uf_list_p_t blend_list,face_list,edge_list;
tag_t body_tag,tem_face,tem_edge,faces,edges,blend_feature;
int face_count,edge_count;
// get faces
UF_MODL_create_list(&face_list);
UF_MODL_ask_feat_body(blk_tag,&body_tag);
UF_MODL_ask_body_faces(body_tag,&face_list);
UF_MODL_ask_list_count(face_list,&face_count);
for(int i =0 ;i <face_count;i++)
{
UF_MODL_ask_list_item(face_list,i,&tem_face);
faces=tem_face;
}
UF_MODL_delete_list(&face_list);
//get edges
UF_MODL_create_list(&edge_list);
UF_MODL_ask_body_edges(body_tag,&edge_list);
UF_MODL_ask_list_count(edge_list,&edge_count);
for(int j = 0 ; j < edge_count;j++)
{
UF_MODL_ask_list_item(edge_list,j,&tem_edge);
edges=tem_edge;
}
UF_MODL_delete_list(&edge_list);
// create the blend
UF_MODL_create_list(&blend_list);
UF_MODL_put_list_item(blend_list,edges);
UF_MODL_create_blend(radius,blend_list,0,0,0,0.5,&blend_feature);
UF_MODL_delete_list(&blend_list);</p><p> // create hole
doublelocation={80,40,40};
doubledirection={0,0,-1};
    const char * diame="15";
const char * depth="5";
const char * angle="0";
tag_t hole_id;
UF_MODL_create_simple_hole(location,direction,diame,depth,angle,faces,faces,&hole_id);</p><p> // create instance
double origin={10,10,0};
double dir={0,0,1};
tag_t cyl_tag;
UF_MODL_create_cyl1(UF_NEGATIVE,origin,"20","10",dir,&cyl_tag);      
char * number_in_x="2";
char * distance_x ="30";
char * number_in_y="2";
char * distance_y ="30";
tag_tfeature_obj_id;
uf_list_p_t feature_list;
UF_MODL_create_list(&feature_list);
UF_MODL_put_list_item(feature_list,cyl_tag);
UF_MODL_create_linear_iset(0,number_in_x,distance_x,number_in_y,distance_y,feature_list,&feature_obj_id);
UF_MODL_delete_list(&feature_list);
}</p>
页: [1]
查看完整版本: NX二次开发-关于body,feature,face,edge 之间的访问源码分享