ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
AMA. Mahesh19/07/2011

Hi,

  I need a clarification to create a extrude feature based on a API program. Let me explain the case as per the attached screen shot in the model.

I need to extrude a rectangle protrusion from the highlighted surface of a cylinder. I used the Surface/Face/Plane option in the “From” surface. I can create an extrusion

using this option manually.

However, I want the same function to be generated using a API program. Herewith, I have attached the part files / image with this.

Below the Code:

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _
Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("RECTANGLE", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.FeatureManager.FeatureExtrusion2 True, False, False, 0, 0, 0.0003, 0.0003, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1, 0, 0, False

Part.SelectionManager.EnableContourSelection = False

End Sub

Thanks,

A.Mahesh