AnsweredAssumed Answered

How to use clear selection

Question asked by Manikandan Babu on Jul 10, 2014

Dear team,


                i am trying to insert centreline for selected rectangular faces in that i have small problem after getting selected objects in user ,get all the face in to loop.

while insert first center line i have to hold two edges only  for that i used clear selection in between but clear selection release all the selected object so i could not add centre line next face.please help me to resolve this.for your reference


Dim swApp As SldWorks.SldWorks

Dim swmodel As SldWorks.ModelDoc2

Dim swdraw As SldWorks.DrawingDoc

Dim swselmgr As SldWorks.SelectionMgr

Dim swface As SldWorks.Face2

Dim SELcount As Long

Dim seltype As Long

Dim I As Integer

Dim J As Long

Dim M  As Integer

Dim SWEDGES  As Variant

Dim SWEDGE As SldWorks.Edge

Dim swentity As SldWorks.Entity

Dim swentity2 As SldWorks.Entity

Dim swentity3 As SldWorks.Entity

Dim swentity4 As SldWorks.Entity

Sub main()

Set swApp = Application.SldWorks

Set swmodel = swApp.ActiveDoc

Set swdraw = swmodel

Set swselmgr = swmodel.SelectionManager

SELcount = swselmgr.GetSelectedObjectCount

For I = 0 To SELcount

seltype = swselmgr.GetSelectedObjectType3(I, -1)

If swSelFACES = seltype Then

Set swface = swselmgr.GetSelectedObject(I)

J = swface.GetEdgeCount

swmodel.ClearSelection2 (True)

If J = 4 Then

SWEDGES = swface.GetEdges


Set swentity2 = SWEDGES(M + 1)

Set swentity = SWEDGE

swentity2.Select True

swentity.Select True


swmodel.ClearSelection2 (True)

Set swentity3 = SWEDGES(M)

Set swentity4 = SWEDGES(M + 2)

swentity3.Select True

swentity4.Select True


End If

End If


End Sub