Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How Revit creates grids

Shulou Source: shulou.com Published: 2022-05-31 14:23:09 10月05日 Update

Today, I would like to share with you the relevant knowledge about how to create a grid in Revit. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Revit API provides two types of grid creation, one is to create curved grids:

Create (Document, Arc)

The other is to create a straight grid:

Create (Document, Line)

It is rare to create curve grids in the same way as straight lines, so the editor mainly introduces how to create linear grids.

The code for creating a grid is very simple, without saying much, just go straight to the code.

Grid gg = Grid.Create (doc, Line.CreateBound (new XYZ (0,0,0), new XYZ (0,0,0)

Explain in detail what this line of code means:

Grid.Create is to create a grid

The parentheses are overloaded.

Line.CreateBound are the two endpoints that create a straight line

(new XYZ (0, 0, 0), new XYZ (0, 2000, 0)) is the coordinate of the two endpoints

To give a name to the grid, use gg.Name = "A"

Here's a hint of how to draw a whole grid (again, copy the template yourself):

Grid G1 = Grid.Create (doc, Line.CreateBound (new XYZ (100,0,0), new XYZ (100,0,0))

G1.Name = "A"

For (int I = 200; I < 2000; I + = 100)

{

G1 = Grid.Create (doc, Line.CreateBound (new XYZ (I, 0,0), new XYZ (I, 2000, 0)

}

Grid G2 = Grid.Create (doc, Line.CreateBound (new XYZ (0,100,0), new XYZ (2000, 100,0))

G2.Name = "1"

For (int j = 200; j < 2000; j + = 100)

{

G2 = Grid.Create (doc, Line.CreateBound (new XYZ (0, j, 0), new XYZ (2000, j, 0))

}

Here, two loops are used to draw a whole equidistant grid, and the name of the first grid is specified, and the name of the grid will be changed automatically.

Let's take a look at the effect:

These are all the contents of the article "how to create grids in Revit". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Lines knowledge articles two code content names that is curves endpoints different very large coordinates most meaning parentheses effects ways more templates Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Huawei Microsoft macOS Redmi