char * title="选择类型创建对象";
int default_item=0;
char items [][38]={"创建球体","创建圆锥"};
int num=2;//控制按钮的个数
int value=uc1603(title,default_item,items,num);
if (value==5)
{
//创建一个球
UF_FEATURE_SIGN sign1=UF_NULLSIGN;
double center[3]={0.0,0.0,0.0};
char *diam="100";
tag_t sphere_object=NULL_TAG;
UF_MODL_create_sphere1(sign1,center,diam,&sphere_object);
}
else{
//创建一个圆锥
UF_FEATURE_SIGN sign2=UF_NULLSIGN;
double origin [ 3 ]={0.0,0.0,0.0};
char * height="100";
char*diam1[2]={"50","0"};
double dir[3]={0.0,0.0,1.0};
tag_t cone_obj_id =NULL_TAG;
UF_MODL_create_cone1(sign2,origin,height,diam1,dir,&cone_obj_id);
}
tag_t view_tag=NULL_TAG; //让视图定位到工作视图
double fraction =1.0;
UF_VIEW_fit_view(view_tag,fraction);
-----------------------------------------------------------------------------------
创建block方块
功能是:自定义点,然后长宽高自定义,然后可以创建方块
涉及到的头文件自己加
```cpp
//---- Enter your callback code here -----
UF_initialize();
//获取对话框上的点
Point3d p1=point0->Point();
//获取对话框上长宽高控件的值
double L1=expression0->Value();
double W1=expression01->Value();
double H1=expression02->Value();
//类型转换
char L2[256],W2[256],H2[256];
sprintf(L2,"%f",L1);
sprintf(W2,"%f",W1);
sprintf(H2,"%f",H1);
UF_FEATURE_SIGN blockSign=UF_NULLSIGN;
double orgin[3]={p1.X,p1.Y,p1.Z};
char *BLICKEdge[3]={L2,W2,H2};
tag_t block_Tag=NULL_TAG;
UF_MODL_create_block1(blockSign,orgin,BLICKEdge,&block_Tag);
char msg[256];
sprintf(msg,"坐标为:%f,%f,%f",p1.X,p1.Y,p1.Z);
uc1601(msg,1);
UF_terminate();
【NX二次开发之用户界面】创建圆柱圆锥
最新推荐文章于 2024-06-24 17:04:06 发布