Item |
Creates a new model line element.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Parameters
- geometryCurve Curve
- The internal geometry curve for model line.
- sketchPlane SketchPlane
- The sketch plane this new model line resides in.
Return Value
ModelCurveIf successful a new model line element. Otherwise .

Exception | Condition |
---|---|
ArgumentException | Thrown when curve is not in the plane |

Different type of model curve element will be returned according to the type of geometry curve.

// get handle to application from document
Autodesk.Revit.ApplicationServices.Application application = document.Application;
// Create a geometry line in Revit application
XYZ startPoint = new XYZ(0, 0, 0);
XYZ endPoint = new XYZ(10, 10, 0);
Line geomLine = Line.CreateBound(startPoint, endPoint);
// Create a geometry arc in Revit application
XYZ end0 = new XYZ(1, 0, 0);
XYZ end1 = new XYZ(10, 10, 10);
XYZ pointOnCurve = new XYZ(10, 0, 0);
Arc geomArc = Arc.Create(end0, end1, pointOnCurve);
// Create a geometry plane in Revit application
XYZ origin = new XYZ(0, 0, 0);
XYZ normal = new XYZ(1, 1, 0);
Plane geomPlane = Plane.CreateByNormalAndOrigin(normal, origin);
// Create a sketch plane in current document
SketchPlane sketch = SketchPlane.Create(document, geomPlane);
// Create a ModelLine element using the created geometry line and sketch plane
ModelLine line = document.Create.NewModelCurve(geomLine, sketch) as ModelLine;
// Create a ModelArc element using the created geometry arc and sketch plane
ModelArc arc = document.Create.NewModelCurve(geomArc, sketch) as ModelArc;
