Is there any macro available to select inner edge of the counter bore as I mentioned below Image?
Thanks
SolidworksApi macros
Is there any macro available to select inner edge of the counter bore as I mentioned below Image?
Thanks
SolidworksApi macros
Hi Prabharan
Please try the below code to select as shown in image.
Dim swApp As SldWorks.SldWorks
Dim swmodel As SldWorks.ModelDoc2
Dim swfeat As SldWorks.Feature
Dim faces As Variant
Dim swface As SldWorks.Face2
Dim i As Integer
Dim swent As SldWorks.Entity
Sub main()
Set swApp = Application.SldWorks
Set swmodel = swApp.ActiveDoc
Set swfeat = swmodel.FeatureByName("CBORE for #6 Binding Head Machine Screw1") 'Hole wizard Name
faces = swfeat.GetFaces
For i = 0 To UBound(faces)
Set swface = faces(i)
Set swent = swface
swent.Select True
Next
End Sub
Manikandan
Hi Manikandan,
Thanks a lot for your reply.
These codes are selecting all faces of the CB hole.
I want to select The inner edge only.
Is there any way to do that?
Thanks
Hi Prabaharan,
Please try the below code to select the edges.here easy to clean the code as per your wish.
Dim swApp As SldWorks.SldWorks
Dim swmodel As SldWorks.ModelDoc2
Dim swfeat As SldWorks.Feature
Dim faces As Variant
Dim edges As Variant
Dim swface As SldWorks.Face2
Dim i,j As Integer
Dim swent As SldWorks.Entity
Sub main()
Set swApp = Application.SldWorks
Set swmodel = swApp.ActiveDoc
Set swfeat = swmodel.FeatureByName("CBORE for #6 Binding Head Machine Screw1") 'Hole wizard Name
faces = swfeat.GetFaces
For i = 0 To UBound(faces)
Set swface = faces(i)
edges = swface.GetEdges
For J = 0 To UBound(edges)
Set swent = edges(J)
swent.Select True
Next J
Next i
End Sub
Manikandan
Thanks for your Reply.
Got It
Hi Manikandan,
Could you please suggest some codes to filter the selection, I don't want to select All of those edges. Just Internal edge only i need as like i shown in last pic.
Thanks
Hi Prabaharan,
Please go through the below code.
Dim swApp As SldWorks.SldWorks
Dim swmodel As SldWorks.ModelDoc2
Dim swfeat As SldWorks.Feature
Dim faces As Variant
Dim edges As Variant
Dim swface As SldWorks.Face2
Dim i As Integer
Dim swent As SldWorks.Entity
Sub main()
Set swApp = Application.SldWorks
Set swmodel = swApp.ActiveDoc
Set swfeat = swmodel.FeatureByName("CBORE for #5 Binding Head Machine Screw1") 'Hole wizard Name
faces = swfeat.GetFaces
'For i = 0 To UBound(faces)
Set swface = faces(1) 'with Near side countersink-2 without Near side countersink-1
edges = swface.GetEdges
'For J = 0 To UBound(edges)
Set swent = edges(0)
swent.Select True
'Next J
'Next i
End Sub
Manikandan
Perfect.
Thank you very much
Hi manikandan,
These codes are working fine. But If I have multiple instances in a single feature, Its recognize first only.
Is there any way to get all instances edges?
Thanks