revitron.room

This submodule contains a wrapper classes for Revit room elements.

Classes:

Room(element)

A wrapper class for room elements.

class Room(element)[source]

Bases: revitron.element.Element

A wrapper class for room elements.

Methods:

__getattr__(name)

Define default method to be returned on attribute errors.

__init__(element)

Inits a new element instance.

delete()

Delete an element.

get(paramName)

Returns a parameter value.

getBbox()

Returns a bounding box for the element.

getBboxCenter([inRoomOnly])

Get the center point of a room’s bounding box.

getBoundary()

Get the boundary of a given room.

getBoundaryInsetPoints([inset])

Get all points along an inset of the room boundary.

getBoundaryPoints()

Get all points along a room boundary.

getCategoryName()

Returns the category name of the element.

getClassName()

Returns the class name of the element.

getDependent([filterClass])

Returns a list of dependent elements.

getFamilyAndTypeName()

Returns the family name of the element.

getFamilyName()

Returns the family name of the element.

getFromType(paramName)

Returns a parameter value of the element type.

getGeometry()

Return the Revitron Geometry instance for this element.

getParameter(paramName)

Returns a parameter object.

getPointBottomLeft([inset])

Get the most bottom left point of a room boundary.

getPointBottomRight([inset])

Get the most bottom right point of a room boundary.

getPointClosest(point[, inset])

Get the point on a room boundary that is the closest to a given point.

getPointGrid([size, inset])

Generates a point grid based on a given size within the room boundary.

getPointTopLeft([inset])

Get the most top left point of a room boundary.

getPointTopRight([inset])

Get the most top right point of a room boundary.

getTags()

Get possibly existing tags of an element.

isNotOwned()

Checks whether an element is owned by another user.

isType()

Checks whether an element is a type or not.

set(paramName, value[, paramType])

Sets a parameter value.

traceHeight(view3D[, elementFilter, …])

Traces the room heights and returns an object containing the min/max bottom and min/max top points.

Attributes:

element

The actual Revit element.

__getattr__(name)

Define default method to be returned on attribute errors.

Since this is a generic element class that is extended by other more specialized classes such as the Room class, a default method along with an error message is returned when accidently calling a special methods that only exists in one of the derived classes on an element of another class.

Parameters

name (string) – The name of the called method

Returns

An empty method

Return type

method

__init__(element)

Inits a new element instance.

Parameters

element (object) – The Revit element or an element ID

delete()

Delete an element.

Example:

_(element).delete()
property element

The actual Revit element.

Returns

The Revit element object

Return type

object

get(paramName)

Returns a parameter value.

Example:

value = _(element).get('name')
Parameters

paramName (string) – The name of the parameter

Returns

The parameter value

Return type

mixed

getBbox()

Returns a bounding box for the element.

Returns

The bounding box or false on error

Return type

object

getBboxCenter(inRoomOnly=False)[source]

Get the center point of a room’s bounding box.

Parameters

inRoomOnly (boolean) – Optionally only return a point in case the bounding box center is actually in the room

Returns

A Revit point object

Return type

object

getBoundary()[source]

Get the boundary of a given room.

Returns

A list of boundary segment curves

Return type

list

getBoundaryInsetPoints(inset=0.1)[source]

Get all points along an inset of the room boundary.

The inset is useful in cases where a point has to be used as a location for a tag and therefore should be located direktly on the boundary but a little bit more inside instead to avoid issues and warnings.

Parameters

inset (float, optional) – The inset. Defaults to 0.1.

Returns

The list of points

Return type

list

getBoundaryPoints()[source]

Get all points along a room boundary.

Returns

A list of points

Return type

list

getCategoryName()

Returns the category name of the element.

Returns

The category name

Return type

string

getClassName()

Returns the class name of the element.

Returns

The class name

Return type

string

getDependent(filterClass=None)

Returns a list of dependent elements.

Parameters

filterClass (class, optional) – An optional class to filter the list of dependent elements by. Defaults to None.

Returns

The list with the dependent Revit elements.

Return type

list

getFamilyAndTypeName()

Returns the family name of the element.

Returns

The family name

Return type

string

getFamilyName()

Returns the family name of the element.

Returns

The family name

Return type

string

getFromType(paramName)

Returns a parameter value of the element type.

Example:

value = _(element).getFromType('name')
Parameters

paramName (string) – The name of the parameter

Returns

The parameter value

Return type

mixed

getGeometry()

Return the Revitron Geometry instance for this element.

Returns

A Revitron Geometry object

Return type

object

getParameter(paramName)

Returns a parameter object.

Parameters

paramName (string) – The name of the parameter

Returns

The parameter object

Return type

object

getPointBottomLeft(inset=0.1)[source]

Get the most bottom left point of a room boundary.

Parameters

inset (float, optional) – An optional room boundary inset. Defaults to 0.1.

Returns

A Revit XYZ object

Return type

object

getPointBottomRight(inset=0.1)[source]

Get the most bottom right point of a room boundary.

Parameters

inset (float, optional) – An optional room boundary inset. Defaults to 0.1.

Returns

A Revit XYZ object

Return type

object

getPointClosest(point, inset=0.1)[source]

Get the point on a room boundary that is the closest to a given point.

Parameters
  • point (object) – A Revit XYZ object

  • inset (float, optional) – An optional room boundary inset. Defaults to 0.1.

Returns

A Revit XYZ object

Return type

object

getPointGrid(size=5, inset=0.05)[source]

Generates a point grid based on a given size within the room boundary.

Parameters
  • size (float, optional) – The maximum grid field size. Defaults to 5.00.

  • inset (float, optional) – The inset of the room boundary. Defaults to 0.05.

Returns

A list of Revit XYZ objects

Return type

list

getPointTopLeft(inset=0.1)[source]

Get the most top left point of a room boundary.

Parameters

inset (float, optional) – An optional room boundary inset. Defaults to 0.1.

Returns

A Revit XYZ object

Return type

object

getPointTopRight(inset=0.1)[source]

Get the most top right point of a room boundary.

Parameters

inset (float, optional) – An optional room boundary inset. Defaults to 0.1.

Returns

A Revit XYZ object

Return type

object

getTags()

Get possibly existing tags of an element.

Returns

A list of Revit tag objects depending on the element class

Return type

list

isNotOwned()

Checks whether an element is owned by another user.

Returns

True if the element is not owned by another user.

Return type

boolean

isType()

Checks whether an element is a type or not.

Returns

True if element is a type.

Return type

bool

set(paramName, value, paramType=False)

Sets a parameter value.

Example:

_(element).set('name', 'value', 'type')

Some possible parameter types are:

  • Text

  • Integer

  • Number

  • Length

  • Angle

  • Material

  • YesNo

  • MultilineText

  • FamilyType

You can find a list of all types here.

Parameters
  • paramName (string) – The parameter name

  • value (mixed) – The value

  • paramType (string, optional) – The parameter type. Defaults to ‘Text’.

Returns

The element instance

Return type

object

traceHeight(view3D, elementFilter=None, gridSize=5, inset=0.05)[source]

Traces the room heights and returns an object containing the min/max bottom and min/max top points.

Parameters
  • view3D (object) – A Revit 3D view.

  • elementFilter (mixed, optional) – Either a list of Revit element IDs or a Revit ElementClassFilter. Defaults to None.

  • gridSize (float, optional) – The maximum grid field size for the raytracing. Defaults to 5.00.

  • inset (float, optional) – The inset of the room boundary. Defaults to 0.05.

Returns

An object containing a top and bottom property.

Both properties are nested objects containing an Min and a Max value.

Return type

object