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

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

 NX9+VS2012

 #include <uf.h>
#include <NXOpen/UI.hxx>
#include <NXOpen/MenuBar_MenuBarManager.hxx> NXOpen::UI *theUI = NXOpen::UI::GetUI(); UF_initialize(); //NX9只有切换到工程图模块的方法,没有获取当前模块名字的方法,所以使用UFUN的函数,混合开发。
int ModuleId;
UF_ask_application_module(&ModuleId);//获取当前所在的模块 if (ModuleId != )//此处等于1,是从帮助找到的,在帮助搜DRAFTING,就可以搜到一堆的宏定义,UG_APP_DRAFTING就等于1.
{
theUI->MenuBarManager()->ApplicationSwitchRequest("UG_APP_DRAFTING");//切换到工程图模块
} UF_terminate();

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

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

 NX11+VS2013

 #include <NXOpen/Session.hxx>

 NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display()); theSession->ApplicationSwitchImmediate("UG_APP_DRAFTING");//切换到工程图模块 NXString Name= theSession->ApplicationName();//获取当前模块的名字 uc1601(Name.GetLocaleText(), );//打印

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

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

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

UFUN Applications 宏定义

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