zoukankan      html  css  js  c++  java
  • NX二次开发-获取NX里的对象信息

    NX二次开发-获取NX里的对象信息

    • 以获取曲线的对象信息为例,实现代码如下。
     1 void GetCurveInfo(tag_t curve, vector<string> &infoStrings)
     2     {
     3         infoStrings.clear();
     4 
     5         if (curve == NULL_TAG)
     6         {
     7             return;
     8         }
     9 
    10         DraftingCurve* draftingCurve = dynamic_cast<DraftingCurve*>(NXObjectManager::Get(curve));
    11 
    12         string fileName = HideListingDevice();
    13 
    14         vector<NXOpen::NXObject*> objs;
    15         objs.push_back(draftingCurve);
    16         GetSession()->Information()->DisplayObjectsDetails(objs);
    17 
    18         ShowListingDevice();
    19 
    20         if (!ReadFile(fileName, infoStrings))
    21         {
    22             return;
    23         }
    24 
    25         fstream file(fileName, ios::out);
    26     }
     1 void ShowListingDevice()
     2 {
     3         ListingWindow *lw = GetSession()->ListingWindow();
     4 
     5         if (lw->IsOpen())
     6         {
     7             lw->Close();
     8         }
     9 
    10         lw->SelectDevice(ListingWindow::DeviceTypeWindow, "");
    11 }
     1 string HideListingDevice()
     2 {
     3         ListingWindow *lw = GetSession()->ListingWindow();
     4 
     5         if (lw->IsOpen())
     6         {
     7             lw->Close();
     8         }
     9 
    10         string tmpFileName = GetConfigDir() + "LineInfo.txt";  #将对象信息导入到txt文件里
    12         fstream file(tmpFileName, ios::out);
    13         lw->SelectDevice(ListingWindow::DeviceTypeFile, tmpFileName.c_str());
    14 
    15         return tmpFileName;
    16 }
  • 相关阅读:
    OI省选知识清单
    FWT板子
    [APIO2018]选圆圈
    [APIO2018]铁人两项
    [Test-1.11]-T4 Transform
    [Test-1.11]-T2divisor
    [Test1.11]-T3对合
    [Test3.3]-T3 Sorting (卡常)
    [Test1.11]-T1匹配 Matching
    二、Unity调用Xcode封装方法
  • 原文地址:https://www.cnblogs.com/xiang-L/p/14132657.html
Copyright © 2011-2022 走看看