hi @A.Acheson,
this is the code i've been using, I still can't figure out how to know which side the occurrence is on (right,left,up or down), in both drawings i'm using the same code only one has more walls(occurrences) than the other one.
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 Componente = comp.Name
Dim BuscarWalls As String = "Wall"
If Componente.Contains(BuscarWalls) = True 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")
''[Find a way to set the dimension depending on where the coordinate is located
''[Declare variables for the dimension position
Dim oMatrix As Matrix = comp.Transformation
Dim x As Double = oMatrix.Cell(1, 4)
Dim y As Double = oMatrix.Cell(2, 4)
Dim z As Double = oMatrix.Cell(3, 4)
Dim dimX As Double
Dim dimY As Double
If x < 0 And y < 0 And z < 0 Then
dimX = 1.10
dimY = -0.02
Else If x > 0 And y < 0 And z < 0 Then
dimX = -0.03
dimY = 1
Else If x > 0 And z > 0 And y < 0 Then
dimX = 0.07
dimY = 1.02
Else If z > 0 And x < 0 And y < 0 Then
dimX = 1.03
dimY = 0
End If
Dim linDim1 = genDims.AddLinear("Width_" & Componente, VIEW1.SheetPoint(dimX, dimY), WPl_Wall_FlangeLeft, WPl_Wall_FlangeRight)
End If
Next
End If
Next
Next

