hoangthe
Mechanical
- May 5, 2021
- 17
I have a projection drawing from 3d, i need to find holes in circle in 2d drawing bane with macro but failed. Can anyone help me see where the error is?
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim SelectionsAll As Selection
Set Selection = drawingDocument1.Selection
MsgBox Selection.Count2
For i = 1 To Selection.Count2
Set RefView1 = Selection.Item(i).Value
Set Element = RefView1.GeometricElements
'Set Element = refView.GeometricElements.GetCurvature RefView
MsgBox TypeName(Element)
Select Case TypeName(Element)
Case "Axis2D":
MsgBox "Axis"
Case "Line2D":
MsgBox "line"
Case "Circle2D":
MsgBox "Circle"
End Select
Next
MsgBox "finish"
End Sub
Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim SelectionsAll As Selection
Set Selection = drawingDocument1.Selection
MsgBox Selection.Count2
For i = 1 To Selection.Count2
Set RefView1 = Selection.Item(i).Value
Set Element = RefView1.GeometricElements
'Set Element = refView.GeometricElements.GetCurvature RefView
MsgBox TypeName(Element)
Select Case TypeName(Element)
Case "Axis2D":
MsgBox "Axis"
Case "Line2D":
MsgBox "line"
Case "Circle2D":
MsgBox "Circle"
End Select
Next
MsgBox "finish"
End Sub