Q: Is there a way to create a RevolveFeature that sweeps a specified angle around a work axis?
A: Starting from Inventor 11 the parameter AxisEntity of the method AddByAngle allows applying a work axis as the axis of the revolution. AxisEntity is an input linear entity that defines the axis of the revolution. This can either be a sketch line in the same sketch that was used to generate the profile or a WorkAxis object.
The following VBA sample creates a revolve feature that sweeps the specified angle (2*Pi) around X base work axis.
Sub AddRevolveByAngleAndAxis()
'Set a reference to the part document
'This assumes a part document is active
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oPartDoc.ComponentDefinition
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
'create new planar sketch on the plane XY
Dim oPlane As WorkPlane
Set oPlane = oDef.WorkPlanes.Item(3)
Dim oSketch As PlanarSketch
Set oSketch = oDef.Sketches.Add(oPlane)
'circle center
Dim oCenter As SketchPoint
Set oCenter = oSketch.SketchPoints _
.Add(oTG.CreatePoint2d(2, 2), False)
'add sketch circle
Dim oCircles As SketchCircles
Set oCircles = oSketch.SketchCircles
Dim oCircle As SketchCircle
Set oCircle = oCircles.AddByCenterRadius(oCenter, 0.5)
'revolve axis
Dim oWorkAxis As Object
Set oWorkAxis = oDef.WorkAxes.Item(1)
'define angle value = 2*Pi
Dim Angle As Variant
Angle = 8 * Math.Atn(1)
'add revolve feature
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oRevFeature As RevolveFeature
Set oRevFeature = oDef.Features.RevolveFeatures _
.AddByAngle(oProfile, oWorkAxis, Angle, _
PartFeatureExtentDirectionEnum.kNegativeExtentDirection, _
PartFeatureOperationEnum.kJoinOperation)
ThisApplication.ActiveView.Fit
Beep
End Sub