AnsweredAssumed Answered

'Extrusion feature' using solidworks api using vb.net

Question asked by Ananth Balasubramanian on May 29, 2018
Latest reply on May 29, 2018 by Nilesh Patel

Guys,I want to extrude a center rectangle using api.

 

#To draw a center rectangle and exit the sketch

   swApp.Visible = True

        swModel = swApp.INewPart()

        swModel = swApp.IActiveDoc2

        swExt = swModel.Extension

        swSelMgr = swModel.SelectionManager

        skManager = swModel.SketchManager

        boolstatus = swExt.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

        skManager.InsertSketch(True)

        Centerrectangle()  # sub program called for drawing a center rectangle

        skManager.InsertSketch(True)

 

# Zoom to fit and isometric view, rotate the component

        swModel.ViewZoomtofit2()

        swModel.ShowNamedView2("*Trimetric", 8)

        swModel.ViewRotate()

 

# Select all edges and points  for the current center rectangle

        boolstatus = swExt.SelectByID2("Edge", swSelectType_e.swSelEDGES, 0, 0, 0, False, 0, Nothing, 0)

        boolstatus = swExt.SelectByID2("Points", swSelectType_e.swSelSKETCHPOINTS, 0, 0, 0, False, 0, Nothing, 0)

 

 

 

# Converting depths from 'm' to 'mm'

        Dim D1 As Double = depth1.Text / 1000

        Dim D2 As Double = depth1.Text / 1000

# Extrusion feature

        myfeature = features1.FeatureExtrusion3(True, False, False, swEndConditions_e.swEndCondBlind, swEndConditions_e.swEndCondBlind, D1, D2, False, False, False, False, 0, 0, False, False, False, False, True, True, True, swStartConditions_e.swStartSketchPlane, 0, False)

 

I've selected all the points and edges on the curve and given a  extrusion feature program, but the extrusion feature fails to execute.

Did I miss something?

Outcomes