当前位置: 首页 > news >正文

NX二次开发-移除参数,删除所有实体参数,移除所有实体参数代码

//移除参数,删除所有实体参数,移除所有实体参数代码 // Mandatory UF Includes #include <uf.h> #include <uf_object_types.h> // Internal Includes #include <NXOpen/ListingWindow.hxx> #include <NXOpen/NXMessageBox.hxx> #include <NXOpen/UI.hxx> // Internal+External Includes #include <NXOpen/Annotations.hxx> #include <NXOpen/Assemblies_Component.hxx> #include <NXOpen/Assemblies_ComponentAssembly.hxx> #include <NXOpen/Body.hxx> #include <NXOpen/BodyCollection.hxx> #include <NXOpen/Face.hxx> #include <NXOpen/Line.hxx> #include <NXOpen/NXException.hxx> #include <NXOpen/NXObject.hxx> #include <NXOpen/Part.hxx> #include <NXOpen/PartCollection.hxx> #include <NXOpen/Session.hxx> // Std C++ Includes #include <iostream> #include <sstream> //用户代码 #include <uf_modl.h> #include <uf_obj.h> #include <uf_part.h> using namespace NXOpen; using std::string; using std::exception; using std::stringstream; using std::endl; using std::cout; using std::cerr; //------------------------------------------------------------------------------ // NXOpen c++ test class //------------------------------------------------------------------------------ class MyClass { // class members public: static Session *theSession; static UI *theUI; MyClass(); ~MyClass(); void do_it(); void print(const NXString &); void print(const string &); void print(const char*); private: BasePart *workPart, *displayPart; NXMessageBox *mb; ListingWindow *lw; LogFile *lf; }; //------------------------------------------------------------------------------ // Initialize static variables //------------------------------------------------------------------------------ Session *(MyClass::theSession) = NULL; UI *(MyClass::theUI) = NULL; //------------------------------------------------------------------------------ // Constructor //------------------------------------------------------------------------------ MyClass::MyClass() { // Initialize the NX Open C++ API environment MyClass::theSession = NXOpen::Session::GetSession(); MyClass::theUI = UI::GetUI(); mb = theUI->NXMessageBox(); lw = theSession->ListingWindow(); lf = theSession->LogFile(); workPart = theSession->Parts()->BaseWork(); displayPart = theSession->Parts()->BaseDisplay(); } //------------------------------------------------------------------------------ // Destructor //------------------------------------------------------------------------------ MyClass::~MyClass() { } //------------------------------------------------------------------------------ // Print string to listing window or stdout //------------------------------------------------------------------------------ void MyClass::print(const NXString &msg) { if(! lw->IsOpen() ) lw->Open(); lw->WriteLine(msg); } void MyClass::print(const string &msg) { if(! lw->IsOpen() ) lw->Open(); lw->WriteLine(msg); } void MyClass::print(const char * msg) { if(! lw->IsOpen() ) lw->Open(); lw->WriteLine(msg); } //------------------------------------------------------------------------------ // Do something //------------------------------------------------------------------------------ void MyClass::do_it() { // 用户代码 //删除所有实体参数 tag_t disp_part_tag, next_tag = NULL_TAG, subtype = NULL_TAG; int num = 0, nm = 0; char *feat_type; int type = UF_solid_type; // 对象类型 UF_solid_type int ssubtype; uf_list_p_t body_list; UF_MODL_create_list(&body_list); disp_part_tag = UF_PART_ask_display_part(); //得到当前部件文件标识 UF_OBJ_cycle_objs_in_part(disp_part_tag, type, &next_tag); while (next_tag != NULL_TAG) { num++; UF_OBJ_ask_type_and_subtype(next_tag, &type, &ssubtype); //获得对象类型 if (ssubtype == UF_solid_body_subtype) //比较对象类型是否固体 { nm++; UF_MODL_put_list_item(body_list, next_tag); //next_tag对象加入到body_list对象列表尾部 } UF_OBJ_cycle_objs_in_part(disp_part_tag, type, &next_tag); } if (nm>0) { UF_MODL_delete_body_parms(body_list); //删除对象列表所有对象参数 } } //------------------------------------------------------------------------------ // Entry point(s) for unmanaged internal NXOpen C/C++ programs //------------------------------------------------------------------------------ // Explicit Execution extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen ) { UF_initialize();//入口函数 try { // Create NXOpen C++ class instance MyClass *theMyClass; theMyClass = new MyClass(); theMyClass->do_it(); delete theMyClass; } catch (const NXException& e1) { UI::GetUI()->NXMessageBox()->Show("NXException", NXOpen::NXMessageBox::DialogTypeError, e1.Message()); } catch (const exception& e2) { UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, e2.what()); } catch (...) { UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, "Unknown Exception."); } UF_terminate();//出口函数 } //------------------------------------------------------------------------------ // Unload Handler //------------------------------------------------------------------------------ extern "C" DllExport int ufusr_ask_unload() { return (int)NXOpen::Session::LibraryUnloadOptionImmediately; }
http://www.jsqmd.com/news/521521/

相关文章:

  • Guohua Diffusion极简交互设计:隐藏复杂参数,新手友好绘画生成
  • 【医疗器械软件合规生死线】:为什么92%的C代码在ISO 13485审核中因3个隐性缺陷被拒?
  • StructBERT零样本分类-中文-base服务监控:Prometheus+Grafana指标采集配置
  • GoGoBright库深度解析:KidBright平台ESP32硬件控制实践指南
  • 嵌入式空气质量传感器驱动框架设计与实践
  • miniredis项目维护指南:贡献代码、问题排查与社区协作的完整教程
  • Qwen-Image-Edit在QT桌面应用中的集成开发
  • Qwen3-0.6B-FP8轻量AI助手搭建:基于开源镜像的开发者私有化部署方案
  • 别再死记硬背了!用这3个真实项目案例,带你吃透软件工程导论的核心概念
  • SDXL 1.0电影级绘图工坊案例展示:用‘水墨山水+AI芯片’生成新国潮科技海报
  • 4个维度解析stlink v1.8.0:嵌入式开发效率提升指南
  • 华硕笔记本性能调优终极指南:告别臃肿控制软件,拥抱轻量高效体验
  • 别再手动循环了!用Activiti6.0多实例节点搞定多人审批(附完整Java代码)
  • Gemma-3-270m数据库优化:MySQL慢查询智能分析方案
  • 如何快速构建国际化技术文档网站:Docusaurus多语言实战指南
  • MQTT消息丢失怎么办?Spring Boot3整合中的QoS配置与消息可靠性保障指南
  • YOLO12惊艳效果:密集小目标(如电路板焊点)检测精度达99.2%
  • 赋能城市交通:智能交通数据可视化系统如何提升地铁运营效率
  • FVC2004指纹数据集:多传感器采集技术与应用场景解析
  • EmbeddingGemma-300m应用案例:客服对话质检与文档聚类实战
  • StructBERT效果对比:结构感知(Structural Awareness)带来的精度提升
  • SeqGPT-560M从模型到服务:FastAPI封装+REST接口发布完整教程
  • 用Win11Debloat优化Windows系统:从诊断到适配的完整方案
  • SpringBoot项目实战:手把手教你搞定苍穹外卖的套餐管理CRUD(附完整代码)
  • 影视动画制作新范式:HY-Motion 1.0实现文生3D人体动作
  • 创建孔、阵列以及body(体)feature(特征)face(面)edge(边)之间的访问源码
  • 别再只用feature_importance了!用SHAP给你的XGBoost回归模型做个‘CT扫描’(附Python代码)
  • Unidbg补JNI环境踩坑实录:从‘乱码’到正确签名的完整调试过程
  • 文墨共鸣快速上手:3步搭建语义相似度评估系统,小白也能用
  • SAP HANA内存计算实战:从列式存储到CDS View的5个高效技巧