Assuming the sketch already exists, and is already named "MySketch"; and assuming the work plane already exists and is already named "MyWorkPlane", you could possibly use something similar to this code.
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch = oDef.Sketches.Item("MySketch")
Dim oWPlane As WorkPlane = oDef.WorkPlanes.Item("MyWorkPlane")
oSketch.Profiles.AddForSolid
Dim oOps As New ArrayList
oOps.Add(PartFeatureOperationEnum.kCutOperation.ToString)
oOps.Add(PartFeatureOperationEnum.kIntersectOperation.ToString)
oOps.Add(PartFeatureOperationEnum.kJoinOperation.ToString)
oOps.Add(PartFeatureOperationEnum.kNewBodyOperation.ToString)
oOps.Add(PartFeatureOperationEnum.kSurfaceOperation.ToString)
Dim oOp As PartFeatureOperationEnum = InputListBox("Choose operation for this extrusion.", oOps, oOps.Item(4), "CHOOSE OPERATION")
Dim oExtFeats As ExtrudeFeatures = oDef.Features.ExtrudeFeatures
Dim oExtDef As ExtrudeDefinition = oExtFeats.CreateExtrudeDefinition(oSketch.Profiles.Item(1), oOp)
Dim oDirections As New ArrayList
oDirections.Add(PartFeatureExtentDirectionEnum.kNegativeExtentDirection.ToString)
oDirections.Add(PartFeatureExtentDirectionEnum.kPositiveExtentDirection.ToString)
oDirections.Add(PartFeatureExtentDirectionEnum.kSymmetricExtentDirection.ToString)
Dim oDir As PartFeatureExtentDirectionEnum = InputListBox("Choose direction(s) of this extrusion.", oDirections, oDirections.Item(2), "CHOOSE DIRECTION")
Dim o2Directions As Boolean = InputRadioBox("Is this extrusion two directional?","True","False")
Dim oDist1 As Double = InputBox("Enter distance for this extrusion.", "DISTANCE")
Dim oDist2 As Double
If o2Directions = False Then
oExtDef.SetDistanceFromFaceExtent(oWPlane,False,oDir,oDist1)
ElseIf o2Directions = True Then
oDist2 = InputBox("Enter second distance for this extrusion.", "DISTANCE 2")
oExtDef.SetDistanceFromFaceExtent(oWPlane,False,oDir,oDist1,True,oDist2)
End If
Dim oExtFeat As ExtrudeFeature = oExtFeats.Add(oExtDef)
oExtFeat.Name = "MyExtrudeFeature"I hope this helps.
If this solves your problem, or answers your questions, please select 'Accept As Solution'.
Or if this helps you out along the way to your solution, please click the 👍 Likes button.
Wesley Crihfield

(Not an Autodesk Employee)