AbhishekChavan
Automotive
- Mar 2, 2025
- 5

I need a CATIA Macro that can create overall or maximum dimensions of a projected drawing view. The geometrical elements from the view has GenerativeBehaviour associated with it and the objects are named "GeneratedItem" with type View. Therefore, I cannot access the geometrical elements to give Dimensions with Dimensions.Add2 Method. Can anyone help me here?

I tried with the below code to return geometrical elements and was planning to use Dimensions.Add2 once I can get the elements as reference.
Code:
Sub MeasureElements()
Dim drawDoc As DrawingDocument
Set drawDoc = CATIA.ActiveDocument
Dim drawSheet As DrawingSheet
Set drawSheet = drawDoc.Sheets.ActiveSheet
Dim drawView As DrawingView
Set drawView = drawSheet.Views.activeView
Dim geoElements As GeometricElements
Set geoElements = drawView.GeometricElements
Dim geoElement As GeometricElement
' For Each geoElement In geoElements
'
'
' Debug.Print TypeName(geoElement)
'
'
'
' Next geoElement
'
'
'
' Debug.Print geoElements.Count
Dim sel1 As Selection
Set sel1 = drawDoc.Selection
sel1.Add drawView
sel1.Search "Name=GeneratedItem,sel"
For i = 1 To sel1.Count2
Debug.Print TypeName(sel1.Item2(i).Value)
Next i
End Sub