Hi,
I Can't able to select the face Using Their Name,I Mentioned the used code for my project below,
Kindly Guide me To select the Faces of the Part.
//===========================================================================================================================
swModel = SwApp.ActivateDoc("EditedShaft.SLDPRT")
swPart = swModel
swModel.Extension.SelectByID2("Boss-Extrude3", "BODYFEATURE", 0, 0, 0, True, 1, Nothing, 0)
'//====SelectionCode
swSelMgr = swModel.SelectionManager
swFeat = swSelMgr.GetSelectedObject6(1, -1)
swSelectData = swSelMgr.CreateSelectData()
swModel.ClearSelection2(True)
FaceArr = swFeat.GetFaces()
If FaceArr Is Nothing Then Exit Sub
For Each OneFace In FaceArr
SwFace = OneFace
SwEnt = SwFace
swFaceFeat = SwFace.GetFeature
If swFaceFeat Is swFeat Then
If OneFace Is FaceArr(0) Then
swPart.SetEntityName(SwEnt, "SelectFace2")
SwEnt.Select4(True, swSelectData)
swModel.ClearSelection2(True)
End If
End If
Next
swModel.Save()
'//=======Matting The Faces Of the Shaft And Coupling
SwApp.ActivateDoc("AssemblySimple.sldasm")
'//===Selecting the faces of the Component Using Their Name
swModel.Extension.SelectByID2("SelectFace1", "FACE", 0, 0, 0, False, 0, Nothing, 0)
swModel.Extension.SelectByID2("SelectFace2", "FACE", 0, 0, 0, True, 1, Nothing, 0)
'//=======Mating the Components
swAssy.AddMate3(1, 0, False, 0, 0, 0, 0, 0, 0, 0, 0, False, iErrors)
//===========================================================================================================================
SolidworksApi macros