【NX二次开发】Block UI 属性类型

时间:2023-03-09 03:05:28
【NX二次开发】Block UI 属性类型

 Block UI 属性类型的读写总结:

帮助文件 NXOpen::BlockStyler::UIBlock::GetProperties()

String类型

//设置值
this->块ID->GetProperties()->SetString("属性名", NXString("字符串")); //获取值
NXString NXstrTemp = "";
NXstrTemp = this->块ID->GetProperties()->GetString("属性名");
char cTemp[133] = "";
strcpy_s(cTemp, 133, NXstrTemp.GetLocaleText());
string strTemp = cTemp;

Strings类型

//设置值
vector<NXString> vecMates;
vecMates.push_back(NXString("字符串1"));
vecMates.push_back(NXString("字符串2"));
vecMates.push_back(NXString("字符串3"));
this->块ID->GetProperties()->SetStrings("属性", vecMates); //读取值
vector<NXString> vecMates;
vecMates = this->块ID->GetProperties()->GetStrings("属性", vecMates);
vector<string> vecStrMates;
for (int i = 0; i < vecMates.size(); i++)
{
vecStrMates.push_back(vecMates[i].GetLocaleText());
}

Logical类型

//设置值
this->块ID->GetProperties()->SetLogical("属性", true); //读取值
bool boolShow = this->块ID->GetProperties()->GetLogical("属性");

Enum类型

//设置值
int intEnum0Value = 0;
this->块ID->GetProperties()->SetEnum("属性", intEnum0Value); //读取值
int intEnum0Value = this->块ID->GetProperties()->GetEnum("属性");

Integer类型

//设置值
int iValue = 99;
this->块ID->GetProperties()->SetInteger("属性", iValue); //获取值
int iValue = this->块ID->GetProperties()->GetInteger("属性");

Double类型

//设置值
double douValue = 99.0;
this->块ID->GetProperties()->SetDouble("属性", douValue); //获取值
double douValue = this->块ID->GetProperties()->GetDouble("属性");

Vector类型

//设置值
double douDir[3] = { 0.0,0.0,1.0 };
Vector3d vecDir(douDir[0], douDir[1], douDir[2]);
this->块ID->GetProperties()->SetVector("属性", vecDir); //获取值
double douDir[3] = {0.0,0.0,0.0};
Vector3d vceDir = this->块ID->GetProperties()->GetVector("属性");
douDir[0] = vceDir.X;
douDir[1] = vceDir.Y;
douDir[2] = vceDir.Z;

Point类型

//设置值
double douPoint[3] = { 0.0,0.0,1.0 };
Point3d poPoint(douPoint[0], douPoint[1], douPoint[2]);
this->块ID->GetProperties()->SetVector("属性", poPoint); //获取值
double douPoint[3] = {0.0,0.0,0.0};
Point3d poPoint = this->块ID->GetProperties()->GetVector("属性");
douPoint[0] = poPoint.X;
douPoint[1] = poPoint.Y;
douPoint[2] = poPoint.Z;

Tag类型

坐等大佬补充,请发到评论中

Utfstring类型

坐等大佬补充,请发到评论中

Utfstrings类型

【NX二次开发】Block UI 属性类型

块ID->SetListItems(vecList);

Stlvector类型

//设置值
vector<int> vecE(2);
vecE[0] = 1;
vecE[1] = 0;
this->块ID->GetProperties()->SetIntegerVector("属性", vecE); //获取值

Attachment类型

坐等大佬补充,请发到评论中

File类型

坐等大佬补充,请发到评论中

Bits类型

//设置值
this->块ID->GetProperties()->SetBits("属性", 0x800); //获取值
...