Hi, I leave two ilogic rules for you to try, which can easily be converted to VBA if you need.
The first will select the holes that have the same diameter.
You must first select a cylindrical face.
Dim oDoc As PartDocument= ThisDoc.Document
Dim oCD As ComponentDefinition = oDoc.ComponentDefinition
Dim oRad1 As Double, Rad2 As Double
Dim oCommand As CommandManager = ThisApplication.CommandManager
Line1 :
Dim oF1 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter,"Select Cylindrical Face")
If oF1.SurfaceType <> 5891 Then GoTo Line1
oRad1 = Round(oF1.Geometry.Radius,3)
oCommand.DoSelect(oF1)
For Each oSolid As SurfaceBody In oCD.SurfaceBodies
For Each oFace As Face In oSolid.Faces
If oFace.SurfaceType = 5891 Then
oRad2 = Round(oFace.Geometry.Radius,3)
If oRad2 = oRad1 Then oCommand.DoSelect(oFace)
End If
Next
Next
Now a rule that must select the flat faces that are at the same height, comparing their coordinates. You must first select the initial flat face
Dim oDoc As PartDocument= ThisDoc.Document
Dim oCD As ComponentDefinition = oDoc.ComponentDefinition
Dim oCommand As CommandManager = ThisApplication.CommandManager
Dim oX1 As Double, oY1 As Double, oZ1 As Double,oX2 As Double, oY2 As Double, oZ2 As Double, oAngle As Double
Line1 :
Dim oF1 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter,"Select Cylindrical Face")
If oF1.SurfaceType <> 5890 Then GoTo Line1
oCommand.DoSelect(oF1)
oX1 =Round(oF1.PointOnFace.X,3)
oY1 =Round(oF1.PointOnFace.Y,3)
oZ1 =Round(oF1.PointOnFace.Z,3)
For Each oSolid As SurfaceBody In oCD.SurfaceBodies
For Each oFace As Face In oSolid.Faces
If oFace.SurfaceType = 5890 Then
oX2 =Round(oFace.PointOnFace.X,3)
oY2 =Round(oFace.PointOnFace.Y,3)
oZ2 =Round(oFace.PointOnFace.Z,3)
If oX1 = oX2 Or oY1 = oY2 Or oZ1 = oZ2 Then
oAngle = Round(ThisApplication.MeasureTools.GetAngle( oF1, oFace),3)
If oAngle = 0 Then oCommand.DoSelect(oFace)
End If
End If
Next
Next
I hope this helps. regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn