字符串控件的应用
参考官方帮助案例:(这个方式感觉更好,第二种方式也可以)E:\NX1980\UGOPEN\SampleNXOpenApplications\C++\BlockStyler\ColoredBlock
普通格式:
读取:
//方法一
string0->GetProperties()->GetString("Value")
//方法二
PropertyList *blockHeightProps = blockHeight->GetProperties();
double theHeight = blockHeightProps->GetDouble("Value");
delete blockHeightProps;
blockHeightProps = NULL;
写入:
//方法一
string0->GetProperties()->SetString("Value", NewObjectAttr[0]);
//方法二
PropertyList *blockHeightProps = blockHeight->GetProperties();
blockHeightProps->SetDouble("MaximumValue", 100.0);
blockHeightProps->SetDouble("MinimumValue", 0.001);
delete blockHeightProps;
blockHeightProps = NULL;
comb格式:
读取:(没有试过自己猜测)
string03->GetProperties()->GetStrings("ListItems");
写入:(用过)
vector<NXString> nxstrtxt03;
nxstrtxt03.push_back(NXOpen::NXString("钢料"));
nxstrtxt03.push_back(NXOpen::NXString("圆料"));
nxstrtxt03.push_back(NXOpen::NXString("重定位钢料"));
nxstrtxt03.push_back(NXOpen::NXString("STD"));
string03->GetProperties()->SetStrings("ListItems", nxstrtxt03);
其中"ListItems"和"Value"表示字符串控件的样式,参考帮助文档Block UI Styler