zoukankan      html  css  js  c++  java
  • NXOpen打开当前部件所在目录

    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); //打开路径

     

    怡宁塑胶模具设计
  • 相关阅读:
    存储过程示例
    对话:关于委托的进一步讨论(转)
    Oracle SQLServer 的随机数问题 .(转)
    AJAX控件之AutoComplete
    穷人与富人的区别
    喜欢(转)
    用sql求得每行行号
    ajax 注册
    如何快速生成100万不重复的8位编号 (转)
    存儲過程的基本語句
  • 原文地址:https://www.cnblogs.com/hqsalanhuang/p/14459656.html
Copyright © 2011-2022 走看看