zoukankan      html  css  js  c++  java
  • NX二次开发-NXOPEN获取所有工程图和所有视图DrawingSheet,DrawingSheetCollection,DraftingView

     1 NX11+VS2013
     2 
     3 #include <NXOpen/Part.hxx>
     4 #include <NXOpen/PartCollection.hxx>
     5 #include <NXOpen/Session.hxx>
     6 #include <NXOpen/ListingWindow.hxx>
     7 #include <NXOpen/NXMessageBox.hxx>
     8 #include <NXOpen/Drawings_DrawingSheet.hxx>
     9 #include <NXOpen/Drawings_DrawingSheetBuilder.hxx>
    10 #include <NXOpen/Drawings_DrawingSheetCollection.hxx>
    11 #include <NXOpen/Drawings_DrawingView.hxx>
    12 #include <NXOpen/Drawings_DrawingViewBuilder.hxx>
    13 #include <NXOpen/NXString.hxx>
    14 
    15 
    16     Session *theSession = NXOpen::Session::GetSession();
    17     Part *workPart(theSession->Parts()->Work());
    18 
    19     //迭代器遍历所有图纸页
    20     vector<NXOpen::Drawings::DrawingSheet*> AllSheet;
    21     NXOpen::Drawings::DrawingSheet* MySheet;
    22     NXOpen::Drawings::DrawingSheetCollection::iterator Ite;//定义迭代器
    23     for (Ite = workPart->DrawingSheets()->begin(); Ite != workPart->DrawingSheets()->end(); ++Ite)
    24     {
    25         MySheet = (*Ite);//赋值
    26         AllSheet.push_back(MySheet);
    27     }
    28 
    29     //获得图纸页里的所有视图
    30     vector<NXOpen::Drawings::DraftingView*> AllSheetView;
    31     for (int i = 0; i < AllSheet.size(); i++)
    32     {
    33         vector<NXOpen::Drawings::DraftingView*> MySheetView = AllSheet[i]->GetDraftingViews();
    34 
    35         for (int j = 0; j < MySheetView.size(); j++)
    36         {
    37             //获取视图名字
    38             NXString ViewName = MySheetView[j]->Name();
    39             AllSheetView.push_back(MySheetView[j]);
    40 
    41             //打印
    42             theSession->ListingWindow()->Open();
    43             theSession->ListingWindow()->WriteLine(ViewName.GetLocaleText());
    44         }
    45     }
    46 
    47 Caesar卢尚宇
    48 2019年11月17日

  • 相关阅读:
    Spring.NET学习笔记(4)对象作用域和类型转换
    spring 依赖注入有什么好处
    加入收藏和设为主页js代码
    hdoj_1027_code
    【C#.NET】ASP.NET状态管理之一:Cookie
    【C#.NET】自定义“验证码”控件(转)
    【C#.NET】C#六种集合性能比较
    【C#.NET】特性和属性
    【C#.NET】ASP.NET 2.0 数据绑定概述(转)
    【C#.NET】ASP.NET状态管理之三:Application
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/11876232.html
Copyright © 2011-2022 走看看