revitron.grid

The Grid submodule contains all classes that are related to Revit grids. It helps you to quickly get filtered lists of grid lines or find closests intersections to given points in orthogonal grids.

Classes:

Grid([typeFilterCsv])

The Grid class is the base class for other grid classes such as the OrthoGrid class.

OrthoGrid([typeFilterCsv])

In contrast to the Grid class, the OrthoGrid object only contains grid lines that are orthogonal.

OrthoGridIntersection(lineX, lineY)

An OrthoGridIntersection object contains all relevant information about an intersection of two orthogonal grid lines.

class Grid(typeFilterCsv=False)[source]

Bases: object

The Grid class is the base class for other grid classes such as the OrthoGrid class. A grid object contains a collection of grid lines. That collection can be filtered when creating a grid instance.

The following example will create a grid object based on all grid lines with a type name that either contains “main” or “sub”:

grid = revitron.Grid('main, sub')

Alternatively you can create a OrthoGrid object only including orthogonal grid lines:

ortho = revitron.OrthoGrid('main, sub')

Methods:

__init__([typeFilterCsv])

Creates a new Grid instance.

Attributes:

lines

The dict of grid lines contained in the Grid object where the grid line name serves as key.

__init__(typeFilterCsv=False)[source]

Creates a new Grid instance. A comma separated string can be passed as an argument to filter the grid elements by their type name.

Parameters

typeFilterCsv (string, optional) – A CSV filter. Defaults to False.

property lines

The dict of grid lines contained in the Grid object where the grid line name serves as key.

Returns

A dict of Revit grid line elements where the grid name serves as key

Return type

dict

class OrthoGrid(typeFilterCsv=False)[source]

Bases: Grid

In contrast to the Grid class, the OrthoGrid object only contains grid lines that are orthogonal.

The following example will create a orthogonal grid object based on all grid lines with a type name that either contains “main” or “sub”:

grid = revitron.OrthoGrid('main, sub')

Methods:

__init__([typeFilterCsv])

Creates a new Grid instance.

closestIntersectionToPointBottomRight(point)

Find the grid intersection that is closest to a given point on the bottom right side.

closestIntersectionToPointTopLeft(point)

Find the grid intersection that is closest to a given point on the top left side.

newLineX(X, name)

Create a new grid line that is defined by single X value and therefore is parallel to the Y axis.

newLineY(Y, name)

Create a new grid line that is defined by single Y value and therefore is parallel to the X axis.

Attributes:

lines

An object that contains one X and one Y property, both dicts containing grid line elements where the grid name serves as key.

__init__(typeFilterCsv=False)

Creates a new Grid instance. A comma separated string can be passed as an argument to filter the grid elements by their type name.

Parameters

typeFilterCsv (string, optional) – A CSV filter. Defaults to False.

closestIntersectionToPointBottomRight(point)[source]

Find the grid intersection that is closest to a given point on the bottom right side.

Parameters

point (object) – A Revit XYZ object

Returns

A OrthoGridIntersection object

Return type

object

closestIntersectionToPointTopLeft(point)[source]

Find the grid intersection that is closest to a given point on the top left side.

Parameters

point (object) – A Revit XYZ object

Returns

A OrthoGridIntersection object

Return type

object

property lines

An object that contains one X and one Y property, both dicts containing grid line elements where the grid name serves as key.

The X property contains all grid lines that are defined by a single value on the X axis and the the Y property contains all grid lines that are defined by a single value on the Y axis.

Note

Note that the lines of the X property are by definition always parallel to the Y axis since they are defined by a single X value and vice versa.

Returns

An object containing orthogonal grid elements split into X and Y lines

Return type

object

static newLineX(X, name)[source]

Create a new grid line that is defined by single X value and therefore is parallel to the Y axis.

Note

Note that the grid line created by this methods marks a position on the X axis that is represented by a line that is parallel to the Y axis.

Parameters
  • X (float) – The position on the X axis

  • name (string) – The name of the new grid line

Returns

A Revit grid element

Return type

object

static newLineY(Y, name)[source]

Create a new grid line that is defined by single Y value and therefore is parallel to the X axis.

Note

Note that the grid line created by this methods marks a position on the Y axis that is represented by a line that is parallel to the X axis.

Parameters
  • Y (float) – The position on the Y axis

  • name (string) – The name of the new grid line

Returns

A Revit grid element

Return type

object

class OrthoGridIntersection(lineX, lineY)[source]

Bases: object

An OrthoGridIntersection object contains all relevant information about an intersection of two orthogonal grid lines.

Attributes:

X

The X coordinate of the intersection on plan.

Y

The Y coordinate of the intersection on plan.

lineX

The Revit grid line element that is defined by a single value on the X axis and is parallel to the Y axis.

lineY

The Revit grid line element that is defined by a single value on the Y axis and is parallel to the X axis.

nameX

The name of the grid line element that is defined by a single value on the X axis.

nameY

The name of the grid line element that is defined by a single value on the Y axis.

Methods:

__init__(lineX, lineY)

Create a new intersection object based on two orthogonal grid lines.

property X

The X coordinate of the intersection on plan.

Returns

The X coordinate

Return type

float

property Y

The Y coordinate of the intersection on plan.

Returns

The Y coordinate

Return type

float

__init__(lineX, lineY)[source]

Create a new intersection object based on two orthogonal grid lines.

Parameters
  • gridX (object) – A Revit grid element

  • gridY (object) – A Revit grid element

property lineX

The Revit grid line element that is defined by a single value on the X axis and is parallel to the Y axis.

Returns

A Revit grid element

Return type

object

property lineY

The Revit grid line element that is defined by a single value on the Y axis and is parallel to the X axis.

Returns

A Revit grid element

Return type

object

property nameX

The name of the grid line element that is defined by a single value on the X axis.

Returns

The name of the grid

Return type

string

property nameY

The name of the grid line element that is defined by a single value on the Y axis.

Returns

The name of the grid

Return type

string