tag_t create_block()
{//创建立方体
double
origin[3]={0.0,0.0,0.0};
char *edge_lens[3]={"1","1","1"};
tag_t block, feature;
UF_MODL_create_block1(UF_NULLSIGN,origin,edge_lens,&feature);
UF_MODL_ask_feat_body(feature,&block);
return block;
}
tag_t
create_cylinder()
{//创建圆柱
double origin[3]={0.0,0.0,0.0};
char *height="2.0";
char *diameter={"1.0"};
double
direction[3]={0.0,0.0,1.0};
tag_t cylinder, feature;
UF_MODL_create_cyl1(UF_NULLSIGN,origin,height,diameter,direction,&feature);
UF_MODL_ask_feat_body(feature,&cylinder);
return cylinder;
}
void qiuhe()
{
//两实体求和
tag_t block, cylinder,
*resulting_bodies = NULL;
int num_results;
block=create_block();
cylinder=create_cylinder();
UF_MODL_unite_bodies(block,cylinder);
//UF_MODL_unite_bodies_with_retained_options
}
void qiujiao()
{
//两实体求交
tag_t block, cylinder, *resulting_bodies = NULL;
int
num_results;
block=create_block();
cylinder=create_cylinder();
UF_MODL_intersect_bodies(block,cylinder,&num_results,&resulting_bodies);
if (num_results > 0)
UF_free(resulting_bodies);
//UF_MODL_intersect_bodies_with_retained_options
}
void qiucha()
{
//两实体求差
tag_t block, cylinder, *resulting_bodies =
NULL;
int num_results;
block=create_block();
cylinder=create_cylinder();
UF_MODL_subtract_bodies(block,cylinder,&num_results,&resulting_bodies);
if (num_results > 0)
UF_free(resulting_bodies);
//UF_MODL_subtract_bodies_with_retained_options
}
原文:https://www.cnblogs.com/feiyangkf/p/14515568.html