Message 1 of 1
drawing dimensions from sub assemblies 3d annotations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
good morning everyone. I wrote this code that allows me to bring out 3d dimensions in drawing views.
Unfortunately I can only get it to work on the first level of assemblies, and not on subassemblies. who can help me?
Sub Main() Dim oDDoc As Document Dim oSheet As Sheet Dim oView As DrawingView ' Assuming you have set ThisDrawing to be the current document oDDoc = ThisDrawing.Document oSheet = oDDoc.ActiveSheet ' Example to select the first view oView = oSheet.DrawingViews.Item(1) ' Set Include3DAnnotations to False for all views Dim view As DrawingView For Each view In oSheet.DrawingViews view.Include3DAnnotations = False Next ' Enable 3D annotations only on the selected view oView.Include3DAnnotations = True End Sub Sub ProcessAllSubOcc(oCompOcc As ComponentOccurrence, oPartNumber As String, componentIsVisible As Boolean) Dim oSubCompOcc As ComponentOccurrence Try For Each oSubCompOcc In oCompOcc.SubOccurrences ' Check if the subcomponent name contains the part number If oSubCompOcc.Name.Contains(oPartNumber) Then oSubCompOcc.Visible = componentIsVisible End If ' Recursively process sub-occurrences If oSubCompOcc.SubOccurrences.Count > 0 Then ProcessAllSubOcc(oSubCompOcc, oPartNumber, componentIsVisible) End If Next Catch ex As Exception ' Handle exceptions if needed, such as logging error messages End Try End Sub