Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I use the code below to add Part number and quantity per each view in the drawing.
I would like to show the part material as well but not being able to find anything similar.
' Set a reference to the drawing document.' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
Dim oViews As DrawingViews
Dim oView As DrawingView
oViews = oActiveSheet.DrawingViews
For Each oView In oViews
If oView.ViewType <> 10504 And oView.ViewType <> 10502 And oView.ViewType <> 10503 And oView.IsFlatPatternView = False Then ' Not kProjectedDrawingViewType
'Get the full filename Of the view model
Dim oModelFileName As String
oModelFileName = oView.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(3).Item(2).Value
'format the text first line
oStringItem = "<StyleOverride Underline='True' FontSize='0.35'> ITEM " & oItemValue & " </StyleOverride>"
'format the text second line
oStringScale = "<Br/><StyleOverride FontSize='0.3'>(Scale <DrawingViewScale/>)</StyleOverride>"
'add to the view label
oQty = "<StyleOverride Font='" & sFont & "' FontSize='" & sFSize1 & "' Bold='FALSE'>" _
& "Quantity: " & "<Property Document='model' PropertySet='User Defined Properties' Property='Qty' " & _
"FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' >Qty</Property></StyleOverride>"
oView.Label.FormattedText = oModelFileName & "<Br/>" _
& oQty
CentText = ThisApplication.TransientGeometry.CreatePoint2d(oView.Center.X - oView.Width/5, oView.Center.Y - oView.Height / 1.8 )
oView.Label.Position= CentText
oView.Label.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
oView.ShowLabel = True
End If
Next
Solved! Go to Solution.