NX11+VS2013

 #include <uf.h>
#include <uf_disp.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_assem.h>
#include <uf_ui.h>
#include <string.h>
#include <NXOpen/NXObjectManager.hxx>
#include <NXOpen/NXException.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/Assemblies_Component.hxx>
#include <NXOpen/Assemblies_ComponentAssembly.hxx>
#include <NXOpen/BasePart.hxx>
#include <NXOpen/MenuBar_ContextMenuProperties.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/PartLoadStatus.hxx>
#include <NXOpen/Selection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/TaggedObject.hxx>
#include <algorithm>
#include <NXOpen/STLCreator.hxx>
#include <NXOpen/DexManager.hxx>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <iterator>
#include <cctype> void MyClass::CycleComponent()
{
//遍历当前part所有component
tag_t ComponentTag = NULL_TAG;
UF_OBJ_cycle_objs_in_part(UF_ASSEM_ask_work_part(), UF_component_type, &ComponentTag);
while (ComponentTag != NULL_TAG)
{
//获的显示的体
UF_OBJ_disp_props_t Componentdisp_props;
UF_OBJ_ask_display_properties(ComponentTag, &Componentdisp_props);
int ComponentBlank = Componentdisp_props.blank_status;
if (ComponentBlank == UF_OBJ_NOT_BLANKED)
{
//把装配子部件设置成工作部件
NXOpen::Assemblies::Component *component1(dynamic_cast<NXOpen::Assemblies::Component *>(NXOpen::NXObjectManager::Get(ComponentTag)));
NXOpen::PartLoadStatus *partLoadStatus1;
theSession->Parts()->SetWorkComponent(component1, NXOpen::PartCollection::RefsetOptionEntire, NXOpen::PartCollection::WorkComponentOptionVisible, &partLoadStatus1);
workPart = theSession->Parts()->Work();
delete partLoadStatus1; //遍历工作部件里的体
CycleComponentBody(); //恢复到装配部件
NXOpen::Assemblies::Component *nullNXOpen_Assemblies_Component(NULL);
NXOpen::PartLoadStatus *partLoadStatus2;
theSession->Parts()->SetWorkComponent(nullNXOpen_Assemblies_Component, NXOpen::PartCollection::RefsetOptionEntire, NXOpen::PartCollection::WorkComponentOptionVisible, &partLoadStatus2);
workPart = theSession->Parts()->Work();
delete partLoadStatus2;
} UF_OBJ_cycle_objs_in_part(UF_ASSEM_ask_work_part(), UF_component_type, &ComponentTag);
} }

NX二次开发-遍历当前part所有component,把装配子部件设置成工作部件的更多相关文章

  1. NX二次开发-基于MFC界面的NX对Excel读写操作(OLE方式(COM组件))

    NX二次开发API里没有对EXCAL读写操作的相关函数,市面上有很多种方法去实现,比如UFUN调KF,ODBC,OLE(COM组件)等等.这里我是用的OLE(COM组件)方式去做的,这种在VC上创建的 ...

  2. NX二次开发-基于NX开发向导模板的NX对Excel读写操作(OLE方式(COM组件))

    在看这个博客前,请读者先去完整看完:NX二次开发-基于MFC界面的NX对Excel读写操作(OLE方式(COM组件))https://ufun-nxopen.blog.csdn.net/article ...

  3. NX二次开发-Block UI C++界面关于 在Block UI中UF_initialize();和UF_terminate();的使用

    关于 在Block UI中UF_initialize();和UF_terminate();的使用 用Block UI作NX二次开发的时候,不需要在使用UFUN函数的时候加UF_initialize() ...

  4. NX二次开发-基于MFC界面对话框与NX交互的开发

    打开VS2013 点击新建,选择MFC DLL 点击确定 点下一步 什么都不改,直接点完成 进来之后先编译一下,看是否编译成功 打开项目属性,更改这几处 $(UGII_BASE_DIR)\ugopen ...

  5. NX二次开发-BlockUI对话框嵌套MFC对话框制作进度条

    半年前在一些QQ群看到有大神NX二次开发做出了进度条,那个时候我还不会弄,也不知道怎么弄得,后来断断续续得研究了一下,直到今天我把它做出来了.内心还是很喜悦的!回想自己这两年当初从没公司肯给我做NX二 ...

  6. NX二次开发-UDO用户自定义对象(UFUN)【持续完善】

    每当提起UDO总是会让我想起大专毕业那会失业找工作,后来有个宝贵机会去了软件公司上班,拿到了我人生中的第一个NX二次开发项目,一个关于测量汽车前后左右摄像头的项目.当时那个项目就用到了UDO,对于只看 ...

  7. NX二次开发-UFUN计算两点距离UF_VEC3_distance

    NX11+VS2013 #include <uf.h> #include <uf_curve.h> #include <uf_vec.h> UF_initializ ...

  8. NX二次开发-UFUN拉伸函数UF_MODL_create_extruded

    NX9+VS2012 //NX二次开发中常用拉伸函数为UF_MODL_create_extruded2,但是此函数不能拉伸片体, //想要拉伸片体用函数UF_MODL_create_extruded. ...

  9. NX二次开发-UFUN拉伸函数UF_MODL_create_extruded2

    NX9+VS2012 //NX二次开发中常用拉伸函数为UF_MODL_create_extruded2,但是此函数不能拉伸片体, //想要拉伸片体用函数UF_MODL_create_extruded. ...

随机推荐

  1. Express post请求无法解析参数的原因

    router.post('/', function(req, res) { console.log(req.body); console.log(req.body.name); console.log ...

  2. magento开发必备插件列表汇总

    magento和wordpress一样,因为开放而倍加优秀 ,搜集下常用的magento插件以便大家使用时更加方便快捷 导航放到右侧:magento-community/RicoNeitzel_Ver ...

  3. delphi 文件夹操作(监控)

    delphi 监控文件系统 delphi 监控文件系统 你是否想为你的Windows加上一双眼睛,察看使用者在机器上所做的各种操作(例如建立.删除文件:改变文件或目录名字)呢? 这里介绍一种利用Win ...

  4. 模拟栈&&模拟队列

    模拟栈:class Stack { private List list = new ArrayList( ); public void push( Object obj ) { this.list.a ...

  5. maven学习整理-基础知识

    1.maven认识 maven是一种自动化的构建工具,它主要解决的问题有: ①项目中的划分规则:原先我们用package或文件夹的形式来划分不同模块,导致在一个项目中存在大量的文件夹和包代码显得庞大: ...

  6. PE代码段中的数据

    PE代码段中可能包含一些数据,比如 optional header中的data directory会索引到一些数据,比如import/export table等等: 还有一些jump table/sw ...

  7. 剑指offer——53字符流中第一个只出现一次的字符

    题目描述 请实现一个函数用来找出字符流中第一个只出现一次的字符.例如,当从字符流中只读出前两个字符"go"时,第一个只出现一次的字符是"g".当从该字符流中读出 ...

  8. Centos7下Firewalld防火墙配置命令

    前    言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态   1 systemctl status firewalld 开机启用/禁用防火墙   1 s ...

  9. LBP算子

    LBP算子特点 LBP(Local Binary Pattern),即局部二值模式,属于一种图像预处理算法,具有光照不变性和旋转不变性. 我目前做的项目是人脸表情识别,采用这种算法可以减少光照和人脸旋 ...

  10. 如何删除github里的项目

    1.登录github网站后,就会看到如下画面,在头像下面有个你的项目资源这一栏,假如我要删除名为“hhh”的项目,现在鼠标点进这个项目里面 2.进去后点setting 点进去后,默认是选择了OPtio ...