NX二次开发-NXOPEN自动切换到工程图模块

UFUN的API里是没有切换到工程图的函数的,NXOPEN里是有方法可以用的。不过应该是不支持NX9以下的版本。

NX9的不能录制出来,在UI类里有方法

 1 NX9+VS2012
 2
 3 #include <uf.h>
 4 #include <NXOpen/UI.hxx>
 5 #include <NXOpen/MenuBar_MenuBarManager.hxx>
 6
 7
 8
 9 NXOpen::UI *theUI = NXOpen::UI::GetUI();
10
11 UF_initialize();
12
13 //NX9只有切换到工程图模块的方法,没有获取当前模块名字的方法,所以使用UFUN的函数,混合开发。
14 int ModuleId;
15 UF_ask_application_module(&ModuleId);//获取当前所在的模块
16
17 if (ModuleId != 1)//此处等于1,是从帮助找到的,在帮助搜DRAFTING,就可以搜到一堆的宏定义,UG_APP_DRAFTING就等于1.
18 {
19     theUI->MenuBarManager()->ApplicationSwitchRequest("UG_APP_DRAFTING");//切换到工程图模块
20 }
21
22 UF_terminate();

NX11的可以录制出来,在Session类里有方法。(从NX10开始就可以录制出来了)

 1 NX11+VS2013
 2
 3 #include <NXOpen/Session.hxx>
 4
 5
 6
 7 NXOpen::Session *theSession = NXOpen::Session::GetSession();
 8 NXOpen::Part *workPart(theSession->Parts()->Work());
 9 NXOpen::Part *displayPart(theSession->Parts()->Display());
10
11 theSession->ApplicationSwitchImmediate("UG_APP_DRAFTING");//切换到工程图模块
12
13 NXString Name= theSession->ApplicationName();//获取当前模块的名字
14
15 uc1601(Name.GetLocaleText(), 1);//打印

UFUN Applications 宏定义

 1 /*****************************************************************************
 2    Unique identifiers for standard NX applications
 3 *****************************************************************************/
 4
 5 #define UF_APP_NONE          (0)      /* No App Module (may be in External UF)*/
 6 #define UF_APP_DRAFTING      (1)      /* Drafting */
 7 #define UF_APP_MECHANISMS    (14)     /* CAE - Mechanisms */
 8 #define UF_APP_CAM           (16)     /* Manufacturing */
 9 /* obsoleted in NX 3         (38)        ICAD - Generative Modeling */
10 #define UF_APP_MODELING      (40)     /* Modeling */
11 #define UF_APP_VALISYS       (47)     /* Valisys - Quality Control */
12 #define UF_APP_GATEWAY       (48)     /* Gateway */
13
14 /* UGMX retired in V18.0.0.12 */
15 #define UF_APP_UGMX          (50)     /* UGMX Interface */
16
17 #define UF_APP_HARNESS       (51)
18 #define UF_APP_FLAT          (60)     /* Sheet Metal Design - Flat Patterns */
19 #define UF_APP_SHTNEST       (61)     /* Sheet Metal Design - Nesting */
20 #define UF_APP_PUNCH         (62)     /* Sheet Metal Design - Punch Press */
21 #define UF_APP_MPG           (63)  /* Sheet Metal Design - Multipart Gridding */
22 #define UF_APP_SSL           (64)     /* Sheet Metal Design - Surface Layout */
23 #define UF_APP_SHTFAB        (65)     /* Sheet Metal Design - Fabrication */
24 #define UF_APP_SMD           (66)     /* Sheet Metal Design Application */
25 #define UF_APP_BUILDER       (67)     /* UI Builder */
26 #define UF_APP_SFEM          (68)     /* CAE Advanced Simulation */
27 #define UF_APP_ROUTE         (69)     /* PSA - Routing Applications */
28               /* obsoleted  (70)        PSA - Virtual Mockup (Division) */
29 #define UF_APP_PIPE          (71)     /* PSA - Routing - Piping */
30 #define UF_APP_TUBE          (72)     /* PSA - Routing - Tubing */
31 #define UF_APP_STEEL         (73)     /* PSA - Routing - Steel */
32 #define UF_APP_CONDUIT       (74)     /* PSA - Routing - Conduit */
33 #define UF_APP_RACEWAY       (75)     /* PSA - Routing - Raceway */
34 #define UF_APP_SHOPS         (76)     /* Manufacturing - Shop floor app */
35 #define UF_APP_WIRE          (77)     /* PSA - Routing - Wiring */
36 #define UF_APP_MTB           (78)     /* Manufacturing - Machine Tool Builder */
37 #define UF_APP_SKETCHER      (79)     /* Sketcher Task Environment */
38 #define UF_APP_NOPART        (80)     /* No Part loaded menubar */
39               /* obsoleted  (81)        CAE - Advanced FEM */
40 #define UF_APP_ROUTE_MECH    (82)     /* PSA - Routing - Mechanical */
41 #define UF_APP_ROUTE_ELEC    (83)     /* PSA - Routing - Electrical */
42 #define UF_APP_ROUTE_LGCL    (84)     /* PSA - Routing - Logical */
43 #define UF_APP_SBSM          (85)     /* SBSM - Straight Break Sheet Metal */
44 #define UF_APP_SEQUENCING    (86)     /* Sequencing Task Environment */
45 #define UF_APP_UFUN          (87)     /* UFUN app */
46 #define UF_APP_STUDIO        (88)     /* Shape Studio */
47 #define UF_APP_DESFEM        (89)     /* CAE - Design Simulation */
48 #define UF_APP_SHIP          (90)     /* PSA - Ship Building */
49 #define UF_APP_AEROSM        (91)     /* PSA - Aerospace Sheet Metal Application */
50 #define UF_APP_FLEX_PCB      (92)     /* Flexible Printed Circuit Design */
51 #define UF_APP_INSPECTION    (93)     /* CMM Inspection Programming */
52 #define UF_APP_MECHATRONICS  (94)     /* Mechatronics Designer */
53 #define UF_APP_STYLER        (95)     /* Block Styler */
54 #define UF_APP_SUBSET_DEFINITION (96) /* Subset Definition task environment */
55 #define UF_APP_TRUE_STUDIO   (97)     /* True Studio Task Environment */
56 #define UF_APP_SHIP_BASICDESIGN (98)  /* Ship Building */
57 #define UF_APP_SHIP_DETAILSDESIGN (99)/* Ship Building */
58 #define UF_APP_SHIP_MANUFACTURE (100) /* Ship Building */
59 #define UF_APP_SINUCAST      (101)    /* SinuCAST */
60 #define UF_APP_SUBDIVISION_MODELING   (102)  /* Subdivision Modeling Task Environment */ 

原文地址:https://www.cnblogs.com/nxopen2018/p/10957482.html

时间: 2024-11-07 01:57:09

NX二次开发-NXOPEN自动切换到工程图模块的相关文章

NX二次开发-NXOPEN更改工程图视图名字baseView1-&gt;SetName(&quot;LSY&quot;);

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 UF_initialize(); 9 10 //新建工程图(A4图纸) 11 char* DrawingName = "Sheet1";//设置图纸名字 12 UF_DRAW_info_t DrawingInfo;//设置图纸大小.

NX二次开发-NXOpen获取边的端点NXOpen::Edge::GetVertices

1 NX9+VS2012 2 3 #include <NXOpen/Features_BlockFeatureBuilder.hxx> 4 #include <NXOpen/Features_FeatureCollection.hxx> 5 #include <NXOpen/NXException.hxx> 6 #include <NXOpen/Body.hxx> 7 #include <NXOpen/BodyCollection.hxx> 8

NX二次开发-NXopen录制:导入IGS

// Created by: Tag_jiang // Language: C++ // Version: NX 10 // Date: 12-24-2019 // Time: 9:00 //头文件 #include <NXOpen/DexBuilder.hxx> #include <NXOpen/DexManager.hxx> #include <NXOpen/NXObject.hxx> #include <NXOpen/ObjectTypeSelector.h

NX二次开发-NXOPEN工程图导出CAD图纸DxfdwgCreator *dxfdwgCreator1;

没有什么可以看的,NXOPEN直接录制一下导出CAD就可以了.录制出来自己挑需要的代码拿过来改一下. 1 NX9+VS2012 2 3 4 #include <NXOpen/Part.hxx> 5 #include <NXOpen/PartCollection.hxx> 6 #include <NXOpen/Session.hxx> 7 #include <NXOpen/DxfdwgCreator.hxx> 8 #include <NXOpen/Dex

NX二次开发-NXOpen读取工程图注释note1-&gt;GetText();

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_drf.h> 5 #include <NXOpen/Annotations_Note.hxx> 6 #include <NXOpen/NXObjectManager.hxx> 7 8 9 UF_initialize(); 10 11 //创建注释 12 char* TextString[] = {"Caesar卢尚宇"}; 13 double

NX二次开发-NXOPEN创建工程图表格Annotations::TableSectionBuilder *tableSectionBuilder1;

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-NXOPEN将工程图转成PDF文件

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <NXOpen/PrintPDFBuilder.hxx> 6 #include <NXOpen/Drawings_DrawingSheet.hxx> 7 #include <NXOpen/NXObjectManager.hxx> 8 #include <NXOpen/PlotManager.hxx> 9

NX二次开发-NXOpen中Point3d类型转换成point类型

1 NX9+VS2012 2 3 #include <NXOpen/NXObject.hxx> 4 #include <NXOpen/Part.hxx> 5 #include <NXOpen/PartCollection.hxx> 6 #include <NXOpen/Point.hxx> 7 #include <NXOpen/PointCollection.hxx> 8 9 NXOpen::Session *theSession = NXOpe

NX二次开发-NXOPEN导出STEP Step214Creator *step214Creator1;

没有什么可以看的,NXOPEN直接录制一下导出STEP就可以了.录制出来自己挑需要的代码拿过来改一下. 1 NX9+VS2012 2 3 #include <NXOpen/Part.hxx> 4 #include <NXOpen/PartCollection.hxx> 5 #include <NXOpen/Session.hxx> 6 #include <NXOpen/Step214Creator.hxx> 7 #include <NXOpen/Dex