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 is); 27 } 28 29 // all views in the drawing sheet obtained 30 Vector <NXOpen Drawings :: :: DraftingView *> AllSheetView; 31 is for ( int I = 0 ; I <AllSheet.size (); ++ I ) 32 { 33 is Vector <NXOpen Drawings :: :: DraftingView *> = MySheetView AllSheet [I] -> GetDraftingViews (); 34 is 35 for ( int J = 0 ; J <MySheetView.size (); J ++ ) 36 { 37 [ // get the view names 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日
NX secondary development -NXOPEN get all the drawings and all views DrawingSheet, DrawingSheetCollection, DraftingView
Guess you like
Origin www.cnblogs.com/nxopen2018/p/11876232.html
Recommended
Ranking