본문 바로가기
cs

Creating a grid with a line or an arc

by kmlab 2018. 3. 21.

 

 

Help

 

help.autodesk.com

void CreateGrid(Autodesk.Revit.DB.Document document)
{
    // Create the geometry line which the grid locates
    XYZ start = new XYZ(0, 0, 0);
    XYZ end = new XYZ(30, 30, 0);
    Line geomLine = Line.CreateBound(start, end);

    // Create a grid using the geometry line
    Grid lineGrid = Grid.Create(document, geomLine);
           
    if (null == lineGrid)
    {
        throw new Exception("Create a new straight grid failed.");
    }

    // Modify the name of the created grid
    lineGrid.Name = "New Name1";
    
    // Create the geometry arc which the grid locates
    XYZ end0 = new XYZ(0, 0, 0);
    XYZ end1 = new XYZ(10, 40, 0);
    XYZ pointOnCurve = new XYZ(5, 7, 0);
    Arc geomArc = Arc.Create(end0, end1, pointOnCurve);

           
    // Create a grid using the geometry arc
    Grid arcGrid = Grid.Create(document, geomArc);
           
    if (null == arcGrid)
    {
        throw new Exception("Create a new curved grid failed.");
    }

    // Modify the name of the created grid
    arcGrid.Name = "New Name2";
}

 

반응형

'cs' 카테고리의 다른 글

Tutorials: My First Revit Plug-in  (0) 2021.10.05
reading a csv file - code evolved  (0) 2018.04.01
Revit API Developers Guide  (0) 2018.03.28
Youtube: Revit API C# Getting Started  (0) 2018.03.22
Creating a new Level  (0) 2018.03.21