surface extension

Dear All,

We got a problem to programmtically extend a surface. The following is our manual process.

step 1: Select the surface

step 2: Make a zero offset

step 3: Extend the offset

step 4: Make an offset of the extended surface

The corresponding code recorded in MACRO recorder is as follows:

-----------------

Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("", "FACE", -0.04249471236312, 5.719734771787E-04, 0.02051603406551, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("", "FACE", -0.04249471236312, 5.719734771787E-04, 0.02051603406551, False, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", -0.04208706777052, 0.002653422134017, 0.01882110630885, True, 0, Nothing, 0)
Part.InsertExtendSurface False, 0, 0.026416
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Surface-Extend5", "REFSURFACE", 0, 0, 0, False, 1, Nothing, 0)
End Sub

-----------------

We follow these steps and develop the steps using C#. Finally we got this.

The created surface has 9 pieces and these are gaps between several pieces, which cause a lot of problem in subsequent operations. Does anyone have any idea about this?

Many thanks for your help

SolidworksApi macros