Message 1 of 5
Create dimension lines in the assembly view of the drawing using points or elements of parts within the assembly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to create code that automatically adds dimensions to assembly views in a drawing.
I would like to display in the assembly view using points or entities that exist in the part.
The code below completes including the part's points in the assembly view. I want to use this to display dimension lines. How do I do this? Also, please let me know how I should modify the code to use non-point entities.
Sub main() Dim oSheet As Sheet = ThisDoc.Document.ActiveSheet Dim oView As DrawingView = ActiveSheet.View("BaseView1").View Dim oDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument Dim silo As Document silo = oDoc.ReferencedDocuments.Item(9) 'hardcoded for the part I need Dim oWP1 As Inventor.WorkPoint = silo.componentdefinition.workpoints.item("DPA1-1") Dim oWPP1 As WorkPointProxy Dim oAssDoc As AssemblyDocument = oDoc Dim oOccs As ComponentOccurrences oOccs = oAssDoc.ComponentDefinition.Occurrences Dim oOcc As ComponentOccurrence For Each oOcc In oOccs 'Chops off ":####" at the End Of occurrance display name Dim oOccName As String oOccName = oOcc.Name Dim trimCount As Integer trimCount = oOccName.Length - oOccName.LastIndexOf(":") oOccName = Left(oOccName, (oOccName.Length - trimCount)) If oOccName = silo.DisplayName oOcc.CreateGeometryProxy(oWP1, oWPP1) oView.SetIncludeStatus(oWPP1, True) End If Next End Sub