File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ ' Check a document is open
2
+ If ThisApplication.Documents.VisibleDocuments.Count = 0 Then
3
+ MessageBox.Show("A Drawing Document needs to be open")
4
+ Exit Sub
5
+ End If
6
+
7
+ ' Check active document
8
+ If ThisApplication.ActiveDocumentType <> Inventor.DocumentTypeEnum.kDrawingDocumentObject Then
9
+ MessageBox.Show("A Drawing Document needs to be open")
10
+ Exit Sub
11
+ End If
12
+
13
+ ' Get the active document
14
+ Dim oDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
15
+
16
+ ' Iterate through all sheets
17
+ For Each oSheet As Inventor.Sheet In oDoc.Sheets
18
+
19
+ ' Check there are views on the sheet
20
+ If oSheet.DrawingViews.Count = 0 Then Continue For
21
+
22
+ ' Iterate through all views
23
+ For Each oView As Inventor.DrawingView In oSheet.DrawingViews
24
+
25
+ ' Check view is a base view, skip if not
26
+ If oView.ViewType <> Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then Continue For
27
+
28
+ ' Turn on view label if it isn't already
29
+ oView.ShowLabel = True
30
+
31
+ ' Set formatted text (this is how you need to add all of your property fields etc.
32
+ oView.Label.FormattedText = "<StyleOverride Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride><Br/><Property Document='model' PropertySet='Design Tracking Properties' Property='Description' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property><Br/><Property Document='model' PropertySet='Inventor Summary Information' Property='Keywords' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='5'>KEYWORDS</Property><Br/><StyleOverride FontSize='0.25'>(</StyleOverride><StyleOverride FontSize='0.25'><DrawingViewScale/></StyleOverride><StyleOverride FontSize='0.25'>)</StyleOverride>"
33
+
34
+ Next ' Next view
35
+ Next ' Next sheet
You can’t perform that action at this time.
0 commit comments