Expression(表达式)控件的获取
NX9+VS2012 #include <uf.h>
#include <uf_modl.h> UF_initialize(); //获取表达式控件的值
PropertyList *ExpressionProps = expression0->GetProperties();
double ExpressionValue = ExpressionProps->GetDouble("Value");
delete ExpressionProps;
ExpressionProps = NULL; PropertyList *ExpressionProps1 = expression01->GetProperties();
double ExpressionValue1 = ExpressionProps1->GetDouble("Value");
delete ExpressionProps1;
ExpressionProps1 = NULL; PropertyList *ExpressionProps2 = expression02->GetProperties();
double ExpressionValue2 = ExpressionProps2->GetDouble("Value");
delete ExpressionProps2;
ExpressionProps2 = NULL; //得到的是double类型,使用时直接拿过来用。
//通常还会double转char去用。例如做长方体长宽高值的时候。
//转换
char L[], W[], H[];
sprintf(L, "%f", ExpressionValue);
sprintf(W, "%f", ExpressionValue1);
sprintf(H, "%f", ExpressionValue2); //然后把char类型的len给到长宽高。
//创建块
UF_FEATURE_SIGN Sign = UF_NULLSIGN;//设置布尔
double Corner_pt[] = {0.0, 0.0, 0.0};//设置原点
char *Edge_Len[] = {L, W, H};//设置长宽高
tag_t BlkTag = NULL_TAG;
UF_MODL_create_block1(Sign, Corner_pt, Edge_Len, &BlkTag); UF_terminate();