标签:Dimension win vs2013 uil collect ++ raft names using
1 NX11+VS2013 2 3 4 #include <NXOpen/Drawings_DrawingSheet.hxx> 5 #include <NXOpen/Drawings_DrawingSheetBuilder.hxx> 6 #include <NXOpen/Drawings_DrawingSheetCollection.hxx> 7 #include <NXOpen/Drawings_DraftingView.hxx> 8 #include <NXOpen/Drawings_DraftingViewCollection.hxx> 9 #include <NXOpen/Drawings_DraftingViewCollection.hxx> 10 #include <NXOpen/Annotations_Dimension.hxx> 11 #include <NXOpen/Annotations_DimensionCollection.hxx> 12 #include <NXOpen/Annotations.hxx> 13 14 15 using namespace NXOpen; 16 using namespace Drawings; 17 using namespace Annotations; 18 19 20 21 //得到当前图纸页 22 NXOpen::Drawings::DrawingSheet* MySheet = workPart->DrawingSheets()->CurrentDrawingSheet(); 23 24 //得到图纸页中的所有视图 25 vector<NXOpen::Drawings::DraftingView*> MySheetViews = MySheet->GetDraftingViews(); 26 27 //得到所有图纸页 28 vector<NXOpen::Drawings::DrawingSheet*> AllSheetsVector;//存到vector 29 NXOpen::Drawings::DrawingSheet* AllSheets;//定义类型 30 NXOpen::Drawings::DrawingSheetCollection::iterator Ite = workPart->DrawingSheets()->begin(); 31 for (; Ite != workPart->DrawingSheets()->end(); ++Ite)//迭代器遍历 32 { 33 AllSheets = (*Ite); 34 AllSheetsVector.push_back(AllSheets); 35 } 36 37 //打开第一张图纸页 38 AllSheetsVector[0]->Open(); 39 40 //将工程图页中的所有视图进行更新 41 workPart->DraftingViews()->UpdateViews(DraftingViewCollection::ViewUpdateOptionAll, MySheet); 42 43 //遍历图纸上的所有标注尺寸 44 vector<NXOpen::Annotations::Dimension*> AllDimensionsVector;//存到vector 45 NXOpen::Annotations::Dimension* AllDimensions;//定义类型 46 NXOpen::Annotations::DimensionCollection::iterator IteDim = workPart->Dimensions()->begin(); 47 for (; IteDim != workPart->Dimensions()->end(); ++IteDim)//迭代器遍历 48 { 49 AllDimensions = (*IteDim); 50 AllDimensionsVector.push_back(AllDimensions); 51 52 //获取每个尺寸的原点位置 53 Point3d DimOrigin = AllDimensions->AnnotationOrigin(); 54 55 56 } 57 58 Caesar卢尚宇 59 2019年11月23日
NX二次开发-NXOPEN_DimensionCollection遍历图纸上的所有标注尺寸
标签:Dimension win vs2013 uil collect ++ raft names using
原文地址:https://www.cnblogs.com/nxopen2018/p/11919756.html