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