Expression(表达式)控件的获取
1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_modl.h> 5 6 7 UF_initialize(); 8 9 //获取表达式控件的值 10 PropertyList *ExpressionProps = expression0->GetProperties(); 11 double ExpressionValue = ExpressionProps->GetDouble("Value"); 12 delete ExpressionProps; 13 ExpressionProps = NULL; 14 15 PropertyList *ExpressionProps1 = expression01->GetProperties(); 16 double ExpressionValue1 = ExpressionProps1->GetDouble("Value"); 17 delete ExpressionProps1; 18 ExpressionProps1 = NULL; 19 20 PropertyList *ExpressionProps2 = expression02->GetProperties(); 21 double ExpressionValue2 = ExpressionProps2->GetDouble("Value"); 22 delete ExpressionProps2; 23 ExpressionProps2 = NULL; 24 25 //得到的是double类型,使用时直接拿过来用。 26 //通常还会double转char去用。例如做长方体长宽高值的时候。 27 //转换 28 char L[256], W[256], H[256]; 29 sprintf(L, "%f", ExpressionValue); 30 sprintf(W, "%f", ExpressionValue1); 31 sprintf(H, "%f", ExpressionValue2); 32 33 //然后把char类型的len给到长宽高。 34 //创建块 35 UF_FEATURE_SIGN Sign = UF_NULLSIGN;//设置布尔 36 double Corner_pt[3] = {0.0, 0.0, 0.0};//设置原点 37 char *Edge_Len[3] = {L, W, H};//设置长宽高 38 tag_t BlkTag = NULL_TAG; 39 UF_MODL_create_block1(Sign, Corner_pt, Edge_Len, &BlkTag); 40 41 UF_terminate();