ItemFactoryBase.NewModelCurve
Public Class
ArgumentException
Creates a new model line element.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public ModelCurve NewModelCurve( Curve geometryCurve, SketchPlane sketchPlane)
Parameters
geometryCurve Curve
The internal geometry curve for model line.
sketchPlane SketchPlane
The sketch plane this new model line resides in.
Return Value
ModelCurve
If successful a new model line element. Otherwise ..
Exceptions
Exception
Condition
ArgumentException
Thrown when curve is not in the plane
Remarks
Different type of model curve element will be returned according to the type of geometry curve.
Example
// get handle to application from documentAutodesk.Revit.ApplicationServices.Application application = document.Application;
// Create a geometry line in Revit applicationXYZ 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 applicationXYZ 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 applicationXYZ 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 documentSketchPlane sketch = SketchPlane.Create(document, geomPlane);
// Create a ModelLine element using the created geometry line and sketch planeModelLine line = document.Create.NewModelCurve(geomLine, sketch) as ModelLine;
// Create a ModelArc element using the created geometry arc and sketch planeModelArc arc = document.Create.NewModelCurve(geomArc, sketch) as ModelArc;