NX二次开发,对象上色
2024-10-22 16:49:48
#include <uf_defs.h>
#include <uf_ui_types.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_modl.h>
#include <uf_obj.h>
#include <uf_modl_primitives.h>
#include <uf_object_types.h>
#include <uf_part.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <NXOpen/Session.hxx>
#include <NXOpen/UI.hxx>
#include <NXOpen/NXMessageBox.hxx>
#include <NXOpen/Callback.hxx>
#include <NXOpen/NXException.hxx>
#include <NXOpen/BlockStyler_UIBlock.hxx>
#include <NXOpen/BlockStyler_BlockDialog.hxx>
#include <NXOpen/BlockStyler_PropertyList.hxx>
#include <NXOpen/BlockStyler_Group.hxx>
#include <NXOpen/BlockStyler_SelectObject.hxx>
#include <NXOpen/BlockStyler_ObjectColorPicker.hxx>
#include <NXOpen/BlockStyler_Enumeration.hxx>
//获取枚举控件
PropertyList *enumProps = enum0->GetProperties();
int corId,colorIndex = enumProps->GetEnum("Value");
delete enumProps;
enumProps = NULL;
switch (colorIndex)
{
case 0: corId = 159; break;
case 1: corId = 4; break;
case 2: corId = 36; break;
case 3: corId = 190; break;
case 4: corId = 186; break;
case 5: corId = 104; break;
case 6: corId = 164; break; default:corId = 159;
}
//设置控件颜色
PropertyList *colorPicker = colorPicker0->GetProperties();
vector<int> setColor(1);
setColor[0] = corId;
colorPicker->SetIntegerVector("Value",setColor);
delete colorPicker;
colorPicker = NULL; UF_initialize();
std::vector<TaggedObject*>objects=this->selection0->GetProperties()->GetTaggedObjectVector("SelectedObjects"); //创建链表
uf_list_p_t List;
UF_MODL_create_list(&List);
//将tag添加到链表
for ( int i=0;i<objects.size();i++) // size 列表长度
{
UF_MODL_put_list_item(List,objects[i]->Tag());
}
//查询链表数量 int Count;
UF_MODL_ask_list_count(List, &Count); tag_t ObjectTag = NULL_TAG;
for (int i = 0; i < Count; i++)
{
//获取链表里的所有tag
UF_MODL_ask_list_item(List, i, &ObjectTag);
//循环上色
UF_OBJ_set_color(ObjectTag,corId);
} //删除链表
UF_MODL_delete_list(&List);
UF_terminate();
最新文章
- android 实现返回键执行home键方法
- C#实体图片下载与批量下载(自动保存功能)
- lightning mdb 源代码分析(4)&mdash;MVCC/COW
- j2ee ehcache
- 1.3 ASP.NET MVC生命周期
- C# winform combobox控件中子项加删除按钮(原创)
- OnClientClick事件
- Max retries exceeded with ur
- 转 --maven系列之二 安装与配置
- Effective C++:规定27:尽量少做动作的过渡
- css颜色值设置方式有哪些?以及如何随机一个颜色?
- Python爬虫——爬豆瓣登录页面
- Linux命令:useradd
- Lintcode401 Kth Smallest Number in Sorted Matrix solution 题解
- [Swift]LeetCode43. 字符串相乘 | Multiply Strings
- THUSC2017题解
- ThinkPHP CI codeignitor 框架 apache 重写 url 隐藏index.php 服务器 报错:Object not found! 可能是.htaccess隐藏index.php
- 使用 properties 配置文件装配 bean 的方式
- Weibull分布(韦伯分布、威布尔分布)
- loj#2721. 「NOI2018」屠龙勇士
热门文章
- 升级版本后,报错go: -i flag is deprecated
- 链接mysql数据库报错:2003-cant connect to Mysql server on ‘localhost’(10038)
- 年羹尧奏摺专集(下).PDF
- socket的客户端和服务端(Windows控制台程序)
- GoLand 和 Pycharm的 快捷键设置与常用插件
- 关闭win10“快速启动”功能
- 查找数组中某个元素出现的次数,例如数组arr=[1,2,3,4,3,4,5,3]中target=3出现的次数
- Idea Diff工具介绍
- Mybatis开发之mapper代理实现自定义接口(常用)
- ADC相关内容