Add a new Revolution instance into the Autodesk Revit family document.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- isSolid
- Type: SystemBoolean
Indicates if the Revolution is Solid or Void.
- profile
- Type: Autodesk.Revit.DBCurveArrArray
The profile of the newly created revolution. This may contain more than one curve loop. Each loop must be a fully closed curve loop and the loops must not intersect. All loops must lie in the same plane. The loop can be a unbound circle or ellipse, but its geometry will be split in two in order to satisfy requirements for sketches used in extrusions.
- sketchPlane
- Type: Autodesk.Revit.DBSketchPlane
The sketch plane for the revolution. The direction of revolution is determined by the normal for the sketch plane.
- axis
- Type: Autodesk.Revit.DBLine
The axis of revolution. This axis must lie in the same plane as the curve loops.
- startAngle
- Type: SystemDouble
The start angle of Revolution in radians.
- endAngle
- Type: SystemDouble
The end angle of Revolution in radians.
Return Value
If creation was successful the new revolution is returned, otherwise an exception with failure information will be thrown.Remarks
This method creates an Revolution in a family document. The Revolution will be rotated the plane of the Revolution profile about the Axis.
Examples

private Revolution CreateRevolution(Autodesk.Revit.DB.Document document, SketchPlane sketchPlane)
{
Revolution revolution = null;
// make sure we have a family document
if (true == document.IsFamilyDocument)
{
// Define a profile for the revolution
CurveArrArray curveArrArray = new CurveArrArray();
CurveArray curveArray = new CurveArray();
// create a rectangular profile for the revolution
XYZ p0 = XYZ.Zero;
XYZ p1 = new XYZ(10, 0, 0);
XYZ p2 = new XYZ(10, 10, 0);
XYZ p3 = new XYZ(0, 10, 0);
Line line1 = Line.CreateBound(p0, p1);
Line line2 = Line.CreateBound(p1, p2);
Line line3 = Line.CreateBound(p2, p3);
Line line4 = Line.CreateBound(p3, p0);
XYZ pp = new XYZ(1, -1, 0);
Line axis1 = Line.CreateBound(XYZ.Zero, pp);
curveArray.Append(line1);
curveArray.Append(line2);
curveArray.Append(line3);
curveArray.Append(line4);
curveArrArray.Append(curveArray);
// create solid rectangular revolution
revolution = document.FamilyCreate.NewRevolution(true, curveArrArray, sketchPlane, axis1, -Math.PI, 0);
if (null != revolution)
{
// move to proper place
XYZ transPoint1 = new XYZ(0, 32, 0);
ElementTransformUtils.MoveElement(document, revolution.Id, transPoint1);
}
else
{
throw new Exception("Create a new Revolution failed.");
}
}
else
{
throw new Exception("Please open a Family document before invoking this command.");
}
return revolution;
}

Private Function CreateRevolution(document As Autodesk.Revit.DB.Document, sketchPlane As SketchPlane) As Revolution
Dim revolution As Revolution = Nothing
' make sure we have a family document
If True = document.IsFamilyDocument Then
' Define a profile for the revolution
Dim curveArrArray As New CurveArrArray()
Dim curveArray As New CurveArray()
' create a rectangular profile for the revolution
Dim p0 As XYZ = XYZ.Zero
Dim p1 As New XYZ(10, 0, 0)
Dim p2 As New XYZ(10, 10, 0)
Dim p3 As New XYZ(0, 10, 0)
Dim line1 As Line = Line.CreateBound(p0, p1)
Dim line2 As Line = Line.CreateBound(p1, p2)
Dim line3 As Line = Line.CreateBound(p2, p3)
Dim line4 As Line = Line.CreateBound(p3, p0)
Dim pp As New XYZ(1, -1, 0)
Dim axis1 As Line = Line.CreateBound(XYZ.Zero, pp)
curveArray.Append(line1)
curveArray.Append(line2)
curveArray.Append(line3)
curveArray.Append(line4)
curveArrArray.Append(curveArray)
' create solid rectangular revolution
revolution = document.FamilyCreate.NewRevolution(True, curveArrArray, sketchPlane, axis1, -Math.PI, 0)
If revolution IsNot Nothing Then
' move to proper place
Dim transPoint1 As New XYZ(0, 32, 0)
ElementTransformUtils.MoveElement(document, revolution.Id, transPoint1)
Else
Throw New Exception("Create a new Revolution failed.")
End If
Else
Throw New Exception("Please open a Family document before invoking this command.")
End If
Return revolution
End Function
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | Thrown when the input argument-profile-is a null reference (Nothing in Visual Basic) or empty array. |
Autodesk.Revit.ExceptionsArgumentNullException | Thrown when the input argument-sketchPlane-is a null reference (Nothing in Visual Basic). |
Autodesk.Revit.ExceptionsArgumentException | Thrown when the input argument-sketchPlane-is an invalid sketch plane. |
Autodesk.Revit.ExceptionsArgumentNullException | Thrown when the input argument-axis-is a null reference (Nothing in Visual Basic). |
Autodesk.Revit.ExceptionsInvalidOperationException | Thrown when creation is attempted in Conceptual Mass, 2D, or other family where revolutions cannot be created. |
Autodesk.Revit.ExceptionsInvalidOperationException | Thrown when the creation failed. |