【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类型

 

块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);

//获取值
...

 

posted @   王牌飞行员_里海  阅读(671)  评论(2编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示