FamilyItemFactoryNewRevolveForms Method |
Create new Form elements by revolve operation, and add them into the Autodesk Revit family document.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic FormArray NewRevolveForms(
bool isSolid,
ReferenceArray profile,
Reference axis,
double startAngle,
double endAngle
)
Public Function NewRevolveForms (
isSolid As Boolean,
profile As ReferenceArray,
axis As Reference,
startAngle As Double,
endAngle As Double
) As FormArray
public:
FormArray^ NewRevolveForms(
bool isSolid,
ReferenceArray^ profile,
Reference^ axis,
double startAngle,
double endAngle
)
member NewRevolveForms :
isSolid : bool *
profile : ReferenceArray *
axis : Reference *
startAngle : float *
endAngle : float -> FormArray Parameters
- isSolid Boolean
- Indicates if the Form is Solid or Void.
- profile ReferenceArray
- The profile of the newly created revolution. It should consist of only one curve loop.
The profile must be in the same plane as the axis.
- axis Reference
- The axis of revolution. The axis is a line that must lie in the same plane as the curves in the profile.
- startAngle Double
- The start angle of Revolution in radians.
- endAngle Double
- The end angle of Revolution in radians.
Return Value
FormArrayIf creation was successful new forms are returned.
RemarksTypically this operation produces only a single form, but some combinations of arguments will create multiple forms from a single profile.
Exampleprivate FormArray CreateRevolveForm(Document document)
{
FormArray revolveForms = null;
ReferenceArray ref_ar = new ReferenceArray();
XYZ ptA = new XYZ(0, 0, 10);
XYZ ptB = new XYZ(100, 0, 10);
Line line = Line.CreateBound(ptA, ptB);
ModelCurve modelcurve = MakeLine(document, ptA, ptB);
ref_ar.Append(modelcurve.GeometryCurve.Reference);
ptA = new XYZ(100, 0, 10);
ptB = new XYZ(100, 100, 10);
modelcurve = MakeLine(document, ptA, ptB);
ref_ar.Append(modelcurve.GeometryCurve.Reference);
ptA = new XYZ(100, 100, 10);
ptB = new XYZ(0, 0, 10);
modelcurve = MakeLine(document, ptA, ptB);
ref_ar.Append(modelcurve.GeometryCurve.Reference);
ptA = new XYZ(-5, 0, 10);
ptB = new XYZ(-5, 10, 10);
ModelCurve axis = MakeLine(document, ptA, ptB);
axis.ChangeToReferenceLine();
revolveForms = document.FamilyCreate.NewRevolveForms(true, ref_ar, axis.GeometryCurve.Reference, 0, Math.PI / 4);
return revolveForms;
}
public ModelCurve MakeLine(Document doc, XYZ ptA, XYZ ptB)
{
Autodesk.Revit.ApplicationServices.Application app = doc.Application;
Line line = Line.CreateBound(ptA, ptB);
XYZ norm = ptA.CrossProduct(ptB);
if (norm.IsZeroLength()) norm = XYZ.BasisZ;
Plane plane = Plane.CreateByNormalAndOrigin(norm, ptB);
SketchPlane skplane = SketchPlane.Create(doc, plane);
ModelCurve modelcurve = doc.FamilyCreate.NewModelCurve(line, skplane);
return modelcurve;
}
See Also