怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

C++ 2010

 

//用户代码
#include <NXOpen/ListingWindow.hxx> //打印信息
#include <NXOpen/NXException.hxx>   //异常处理
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/BasePart.hxx>
#include <atlstr.h>
#include <iostream>
#include <sstream>


 //用户代码

 theSession->ListingWindow()->Open();//打开信息窗口
 BasePart *basedisplaypart = theSession->Parts()->BaseDisplay();//获取顶层显示部件
 NXString directory = basedisplaypart->FullPath();//获取顶层显示部件路径
 string  filedirectorypath = directory.GetLocaleText();//字符串转换
 int end1 = (int)filedirectorypath.find_last_of("\\");//找到顶层显示部件路径中的最后一个反斜杠
 string filedirectorypath1 = filedirectorypath.substr( 0, end1 + 1 );//分割部件全路径名获取显示部件路径
 //theSession->ListingWindow()->WriteLine(filedirectorypath1);

 //方法一
 ShellExecute(NULL,"open","Explorer.exe",filedirectorypath1.c_str(),NULL,SW_SHOWDEFAULT);

 //方法二
 //char filedirectorypath2[256];
 //sprintf (filedirectorypath2,"start \"\" \"%s\"",filedirectorypath1.c_str());
 //theSession->ListingWindow()->WriteLine(filedirectorypath2);
 //system(filedirectorypath2); //打开路径

 

 

posted on 2021-02-28 16:52  怡宁塑胶模具设计  阅读(428)  评论(0编辑  收藏  举报