AnsweredAssumed Answered

Select a part face with SelectByID2

Question asked by Denis Leclerc on Apr 8, 2019
Latest reply on Apr 17, 2019 by Abhishek Lad


As you can see above, I have a simple block with a face named "Test". I am trying to select that face with the following code:

Sub main()

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim mateSelMark As Long

Dim status As Boolean

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swModelDocExt = swModel.Extension

swModel.ClearSelection2 True

status = swModelDocExt.SelectByID2("Test", "FACE", 0, 0, 0, True, mateSelMark, Nothing, swSelectOption_e.swSelectOptionDefault)


the status returns "false" as the result of the selection. That face is not selected. What am I doing wrong?