Creates a new model line element.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
C# |
---|
public ModelCurve NewModelCurve( Curve geometryCurve, SketchPlane sketchPlane ) |
Visual Basic |
---|
Public Function NewModelCurve ( _ geometryCurve As Curve, _ sketchPlane As SketchPlane _ ) As ModelCurve |
Visual C++ |
---|
public: ModelCurve^ NewModelCurve( Curve^ geometryCurve, SketchPlane^ sketchPlane ) |
Parameters
- geometryCurve
- Type: Autodesk.Revit.DB..::..Curve
The internal geometry curve for model line.
- sketchPlane
- Type: Autodesk.Revit.DB..::..SketchPlane
The sketch plane this new model line resides in.
Return Value
If successful a new model line element. Otherwise nullNothingnullptra null reference (Nothing in Visual Basic).
Remarks
Different type of model curve element will be returned according to the type of geometry curve.
Examples

// 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;

' get handle to application from document Dim application As Autodesk.Revit.ApplicationServices.Application = document.Application ' Create a geometry line in Revit application Dim startPoint As New XYZ(0, 0, 0) Dim endPoint As New XYZ(10, 10, 0) Dim geomLine As Line = Line.CreateBound(startPoint, endPoint) ' Create a geometry arc in Revit application Dim end0 As New XYZ(1, 0, 0) Dim end1 As New XYZ(10, 10, 10) Dim pointOnCurve As New XYZ(10, 0, 0) Dim geomArc As Arc = Arc.Create(end0, end1, pointOnCurve) ' Create a geometry plane in Revit application Dim origin As New XYZ(0, 0, 0) Dim normal As New XYZ(1, 1, 0) Dim geomPlane As Plane = Plane.CreateByNormalAndOrigin(normal, origin) ' Create a sketch plane in current document Dim sketch As SketchPlane = SketchPlane.Create(document, geomPlane) ' Create a ModelLine element using the created geometry line and sketch plane Dim line__1 As ModelLine = TryCast(document.Create.NewModelCurve(geomLine, sketch), ModelLine) ' Create a ModelArc element using the created geometry arc and sketch plane Dim arc__2 As ModelArc = TryCast(document.Create.NewModelCurve(geomArc, sketch), ModelArc)
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentException | Thrown when curve is not in the plane |