Find the circle
Find the circle
(OP)
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

RE: Find the circle
Regards,
M
RE: Find the circle
RE: Find the circle
RE: Find the circle
RE: Find the circle
RE: Find the circle
You can find the circle by Isolating the link.
This is not a very pretty method, but here is an example of temporarily copying and pasting a view, Isolating it, and then deleting it once the necessary information is retrieved.
A new view is created near the origin, and the result is text for each diameter.
CODE --> vba
RE: Find the circle
Thanks. I see this code select all arcs (not closed circles) how can only closed circles be selected?
RE: Find the circle
Rewrite the get_circles function next and add the is_close_circle function.
CODE --> vba
RE: Find the circle
thanks for your help, it's great
RE: Find the circle
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim SelectionsAll As Selection
Set SelectionsAll = drawingDocument1.Selection
For Each RefView1 In SelectionsAll
Dim Elements As GeometricElements
Set Elements = RefView1.GeometricElements
For Each Element In Elements
Select Case TypeName(Element)
Case "Axis2D":
MsgBox "Axis"
Case "Line2D":
MsgBox "Line"
Case "Circle2D":
MsgBox "Circle"
End Select
Next Element
Next RefView1
MsgBox "Finish"
End Sub