AnsweredAssumed Answered

Create Fill Surface SolidWorks from VBA Excel

Question asked by Riandro Pramudyo on Apr 24, 2019
Latest reply on Jun 2, 2019 by Riandro Pramudyo

Hi All.,


I have tried to create program in VBA Ms Excel to create Fill Surface from 2 Helix and 2 2D skecthes, but my program can not create file surface in solidworks softwre

Set swApp = CreateObject("SldWorks.Application")

Set Part = swApp.ActiveDoc


'Get the sketch for the fill-surface feature

boolstatus = Part.Extension.SelectByID2("Helix/Spiral1", "REFERENCECURVES", 0, 0, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("Helix/Spiral2", "REFERENCECURVES", 0, 0, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("Sketch10", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("Sketch11", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)


Dim swSelMgr As Object

Dim selObj As Object

Set swSelMgr = Part.SelectionManager

Set selObj = swSelMgr.GetSelectedObject6(1, 257)


Dim swFeat As Object

'Insert the fill-surface feature

Set swFeat = swFeatMgr.InsertFillSurface2(2, swOptimizeSurface, selObj, swContact, Nothing, Nothing)


End Sub


My program is finished to the end (there is no notification about debugging) but after running the program, the program only can choose 2 Helix and 2 2D sketches without create a Fill Surface


Are there wrong with my program in VBA excel to create fill surface in SOLIDWORKS?