AnsweredAssumed Answered


Question asked by Vigneshkumar Sarathy on Aug 7, 2018
Latest reply on Aug 7, 2018 by Alex Burnett

I am new to Solidworks API. Tried to write a code to do Sweep function using a 3D line Sketch and circle as path and profile. Full code has been given below. i am getting till before last command line to create swept feature. Circle and line are created and in the selected position when i am getting run time error  '438' - Object doesnt Support this property or method. i dont understand the parameters passed to the Swept feature. ALso please give explaination about the parameters passed to the different Swept feature.


Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSketchManager As SldWorks.SketchManager

Dim swSketchSegment As SldWorks.SketchSegment

Dim swSketch As SldWorks.Sketch

Dim status As Boolean

Dim myFeature As SldWorks.FeatureManager

Dim swSketchMgr As SldWorks.SketchManager

Dim boolstatus As Boolean

Sub main()

    Set swApp = Application.SldWorks


    Set swModel = swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks 2015\templates\Part.prtdot", 0, 0, 0)


    Set swSketchManager = swModel.SketchManager

    swSketchManager.Insert3DSketch True

    Set swSketchSegment = swSketchManager.CreateLine(0, 0, 0#, 1, 0, 0#)

    Set swSketch = swSketchManager.ActiveSketch


    swModel.ClearSelection2 True

    swSketchManager.InsertSketch True



    swModel.ClearSelection2 True

    swSketchManager.InsertSketch True

    Set swModelDocExt = swModel.Extension

    status = swModelDocExt.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

    Set swSketchSegment = swSketchManager.CreateCircle(0, 0, 0#, 0.005, 0, 0#)

    swModel.ClearSelection2 True


    swModel.ClearSelection2 True

    swSketchManager.InsertSketch True


    boolstatus = swModelDocExt.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)

    boolstatus = swModelDocExt.SelectByID2("3DSketch1", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)

   Set myFeature = swModel.FeatureManager.InsertProtrusionSwept3(False, False, 0, False, False, 1, 1, False, 0, 0, 0, 0, True, True, True, 0, True, True, True, False)



End Sub