Create new Form elements by revolve operation, and add them into the Autodesk Revit family document.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 18.0.0.0 (18.2.0.13)
Syntax
Return Value
If creation was successful new forms are returned.
Remarks
Examples
CopyC#
private 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;
}
CopyVB.NET
Private Function CreateRevolveForm(document As Document) As FormArray
Dim revolveForms As FormArray = Nothing
Dim ref_ar As New ReferenceArray()
Dim ptA As New XYZ(0, 0, 10)
Dim ptB As New XYZ(100, 0, 10)
Dim line__1 As Line = Line.CreateBound(ptA, ptB)
Dim modelcurve As 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)
Dim axis As ModelCurve = MakeLine(document, ptA, ptB)
axis.ChangeToReferenceLine()
revolveForms = document.FamilyCreate.NewRevolveForms(True, ref_ar, axis.GeometryCurve.Reference, 0, Math.PI / 4)
Return revolveForms
End Function
Public Function MakeLine(doc As Document, ptA As XYZ, ptB As XYZ) As ModelCurve
Dim app As Autodesk.Revit.ApplicationServices.Application = doc.Application
Dim line__1 As Line = Line.CreateBound(ptA, ptB)
Dim norm As XYZ = ptA.CrossProduct(ptB)
If norm.IsZeroLength() Then
norm = XYZ.BasisZ
End If
Dim plane As Plane = plane.CreateByNormalAndOrigin(norm, ptB)
Dim skplane As SketchPlane = SketchPlane.Create(doc, plane)
Dim modelcurve As ModelCurve = doc.FamilyCreate.NewModelCurve(line__1, skplane)
Return modelcurve
End Function
See Also