NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference

 1 NX11+VS2013
 2 
 3 
 4 #include 
 5 #include 
 6 #include 
 7 #include 
 8 #include 
 9 #include 
10 #include 
11 #include 
12 #include 
13 #include 
14 #include 
15 
16 
17 using namespace NXOpen;
18 using namespace Drawings;
19 using namespace std;
20 
21 
22     NXOpen::Session *theSession = NXOpen::Session::GetSession();
23     NXOpen::Part *workPart(theSession->Parts()->Work());
24     NXOpen::Part *displayPart(theSession->Parts()->Display());
25 
26     //获得当前图纸页
27     NXOpen::Drawings::DrawingSheet* DrawingSheet = workPart->DrawingSheets()->CurrentDrawingSheet();
28 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第1张图片
29     //将此图纸的视图设置为活动草图视图
30     DrawingSheet->ActivateForSketching();
31 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第2张图片
32     //返回边框和区域对象(如果存在)
33     NXOpen::Drawings::BordersAndZones *DrawingBorder = DrawingSheet->BordersAndZones();
34 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第3张图片
35     //获得图纸页上的所有视图
36     std::vector DrawingViews = DrawingSheet->GetDraftingViews();
37     for (int i = 0; i < DrawingViews.size(); i++)
38     {
39         //获得视图的tag
40         tag_t ViewTag = DrawingViews[i]->Tag();
41 
42         //打印
43         char msg[256];
44         sprintf_s(msg, "%d", ViewTag);
45         UI::GetUI()->NXMessageBox()->Show("标题", NXMessageBox::DialogTypeWarning, msg);
46 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第4张图片
47         //如果定义了工作表区域,则返回工作表的工作表和区域位置或引用
48         NXString SheetZoneReference = DrawingSheet->GetSheetZoneReference(DrawingViews[i]);
49         const char* SheetZoneReference1 = SheetZoneReference.GetLocaleText();
50     }
51 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第5张图片
52     //获得图纸比例
53     double numerator;
54     double denominator;
55     DrawingSheet->GetScale(&numerator, &denominator);
56 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第6张图片
57     //获得图纸的高度
58     double DrawingHeight = DrawingSheet->Height();
59 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第7张图片
60     //如果此图纸的视图是活动草图视图,则返回true。
61     bool IsActive = DrawingSheet->IsActiveForSketching();
62 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第8张图片
63     //返回图纸页是否过期的状态
64     bool IsOutOfDate = DrawingSheet->IsOutOfDate();
65 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第9张图片
66     //获得图纸的长度
67     double DrawLength = DrawingSheet->Length();
68 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第10张图片
69     //打开图纸页
70     DrawingSheet->Open();
71 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第11张图片
72     //获得图纸页的投影角度
73     NXOpen::Drawings::DrawingSheet::ProjectionAngleType ProjectionAngle = DrawingSheet->ProjectionAngle();
74     
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第12张图片
75     //设置图纸的参数
76     DrawingSheet->SetParameters(200, 200, 1, 1, DrawingSheet::UnitMillimeters, DrawingSheet::ProjectionAngleTypeFirstAngle, DrawingViews);
77 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第13张图片
78     //返回属于此图纸的SheetDraftingViewCollection实例
79     NXOpen::Drawings::SheetDraftingViewCollection* ViewCollection = DrawingSheet->SheetDraftingViews();
80     
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第14张图片
81     //返回属于此图纸的SheetSectionLineCollection实例
82     NXOpen::Drawings::SheetSectionLineCollection * LineCollection = DrawingSheet->SheetSectionLines();
83 
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第15张图片
84     //获得图纸的单位
85     NXOpen::Drawings::DrawingSheet::Unit DrawingUnit = DrawingSheet->Units();
86         
NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第16张图片
87     //返回表示此图纸的视图
88     NXOpen::View* MyView = DrawingSheet->View();

NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference_第17张图片

你可能感兴趣的:(NX二次开发-NXOpen::Drawings::DrawingSheet Class Reference)