Revit API Development (7): Creating Model Lines

Source: Internet
Author: User

In Revitapi, the method of creating a model line is not in the class Modelcurve itself, which is a common confusion with APIs, and does not know where to use the interface. This can only be accumulated through experience.
The API for creating model lines is: Autodesk.Revit.Creation.NewModelCurve

Public Modelcurve Newmodelcurve (
    Curve geometrycurve,
    sketchplane sketchplane
)

Model Curve has 5 kinds of types, through the input corresponding Curve can get different modelcurve.

Autodesk.revit.db::modelcurve
    Autodesk.revit.db::modelarc//ARC
    autodesk.revit.db::modelellipse//Oval Line
    Autodesk.revit.db::modelhermitespline
    Autodesk.revit.db::modelline//Straight line
    Autodesk.revit.db::modelnurbspline

The following example creates a straight line and an arc:

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

You can also do this through the Dynamo for Revit:

Effects in Dynamo for Revit:

Effects in Revit:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.