Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I do not know if you can help me I have an assembly with many occurrences when I want to dimension them in an automatic way it has been complicating me a lot, I just found out that there are the instance property I do not know if it is possible to read them from the code so that if it finds a certain letter in the instance property inside the occurrence it makes the dimensions.
Dim drawingDoc As DrawingDocument = ThisApplication.ActiveDocument
' Loop through each sheet in the drawing document
For Each sheet As Sheet In drawingDoc.Sheets
' Loop through each view on the sheet
For Each view As DrawingView In Sheet.DrawingViews
If View.Name = "VIEW1" Then
' Check if the view is an assembly view
' Get the assembly document for the view
Dim asmDoc As AssemblyDocument = View.ReferencedDocumentDescriptor.ReferencedDocument
' Loop through each assembly component
For Each comp As ComponentOccurrence In asmDoc.ComponentDefinition.Occurrences
Dim componentName As String = comp.Name
Dim Search As String = "Wall"
If componentName.Contains(Search) Then
' Add a dimension to the component if the component name contains "Wall"
Dim ShGeneral = ThisDrawing.Sheets.ItemByName("General:1")
Dim genDims = ShGeneral.DrawingDimensions.GeneralDimensions
Dim view1 = ShGeneral.DrawingViews.ItemByName("VIEW1")
Dim wPl_Wall_FlangeLeft = view1.GetIntent(comp.Name, "WPl_Wall-FlangeLeft")
Dim wPl_Wall_FlangeRight = view1.GetIntent(comp.Name, "WPl_Wall-FlangeRight")
Dim dimX As Double
Dim dimY As Double
'' Add the dimension to the drawing
Dim linDim1 = genDims.AddLinear("Width_" & componente, view1.SheetPoint(dimX, dimY), wPl_Wall_FlangeLeft, wPl_Wall_FlangeRight)
End If
Next
End If
Next
Next
Solved! Go to Solution.