I got a api sample from SW
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("", "FACE", -6.266362388132E-04, -0.006898872254226, -0.002000000000066, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", -5.995126677618E-04, -0.01662175306552, -0.008695278400836, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.001182220862944, -0.02209251409255, -0.02786396878545, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Surface-Plane1", "SURFACEBODY", -0.000949804757461, -0.004340448254709, -0.04000000000005, True, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("", "FACE", -6.266362388132E-04, -0.006898872254226, -0.002000000000066, False, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", -5.995126677618E-04, -0.01662175306552, -0.008695278400836, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.001182220862944, -0.02209251409255, -0.02786396878545, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Surface-Plane1", "SURFACEBODY", -0.000949804757461, -0.004340448254709, -0.04000000000005, True, 1, Nothing, 0)
Dim myFeature As Object
Set myFeature = Part.FeatureManager.InsertSewRefSurface(True, True, False, 0.0000025, 0.0001)
End Sub
but when I transform it to C# to use in my add-in program
swModel.ClearSelection();
foreach (Face2 f in selFaces)
{
boolstatus = swModelDocExt.SelectByID2("", "FACE", 0, 0, 0, true, 0, null, 0); //boolstatus gets true here
}
boolstatus = swModelDocExt.SelectByID2(name, "SURFACEBODY", 0, 0, 0, true, 0, null, 0); //boolstatus gets true here
obj =(object) swFeatMgr.InsertSewRefSurface(true, true, false, 0.000025, 0.0001);
I always get null, can anyone tell what is wrong with this?
SolidworksApi macros