revitron.geometry¶
The Geometry submodule and its Geometry
class contain useful helpers for handling
Revit element geometries. Note that it is possible to use the _()
shorthand to get
the geometry of an element as follows:
geometry = _(element).getGeometry()
The full syntax without using the shorthand can also be used:
geometry = revitron.Geometry(element)
Classes:
|
A collection of useful methods for handling Revit element geometries. |
The GeometryUtils class contains a collection of static utility methods for dealing with geometry related tasks. |
- class Geometry(element)[source]¶
Bases:
object
A collection of useful methods for handling Revit element geometries.
Methods:
__init__
(element)Inits a new Geometry instance.
getCurves
([curveType])Get a list of all curves by type of a given element.
getFaces
()Get a list of all faces of a given element.
Get a list of all solids of a given element.
- __init__(element)[source]¶
Inits a new Geometry instance.
- Parameters
element (object) – A Revit element
- getCurves(curveType='Line')[source]¶
Get a list of all curves by type of a given element.
Note
Child classes of Autodesk.DB.Curve can be used.
- Parameters
curveType (str, optional) – The type of curve to return.
'Line'. (Defaults to) –
- Returns
A list of curve objects
- Return type
list
- class GeometryUtils[source]¶
Bases:
object
The GeometryUtils class contains a collection of static utility methods for dealing with geometry related tasks.
Methods:
getAbsoluteAngleXY
(base, endpoint)Get the absolute angle between 0 and 360 degrees of a vector counter clockwise relative to the X-axis.
getAngleXY
(base, reference, endpoint)Get the angle from a vector to a reference.
getBoundaryPoints
(boundary)Get a list of points from a given boundary that is usually returned by methods such as
GetBoundarySegments
.polygonContainsPointXY
(polygonPoints, point)Check whether a given polygon that is planar to a horizontal surface contains a given point.
- static getAbsoluteAngleXY(base, endpoint)[source]¶
Get the absolute angle between 0 and 360 degrees of a vector counter clockwise relative to the X-axis.
- Parameters
base (XYZ) – The base point that represents 0,0 of the coordinate system
endpoint (XYZ) – The endpoint of the line starting from the basepoint that represents the vector in question
- Returns
The absolute angle between 0 and 360 degrees
- Return type
float
- static getAngleXY(base, reference, endpoint)[source]¶
Get the angle from a vector to a reference. Note that the result returns positiv as well as negative angles depending on the relative location of the reference vector.
- Parameters
base (XYZ) – The base point that represents 0,0 of the coordinate system
reference (XYZ) – The endpoint of the reference line starting from the basepoint
endpoint (XYZ) – The endpoint of the line starting from the basepoint that represents the vector in question
- Returns
The angle
- Return type
float
- static getBoundaryPoints(boundary)[source]¶
Get a list of points from a given boundary that is usually returned by methods such as
GetBoundarySegments
.- Parameters
boundary (list) – A list of boundary segment lists
- Returns
The list of points that define a boundary polygon
- Return type
list
- static polygonContainsPointXY(polygonPoints, point)[source]¶
Check whether a given polygon that is planar to a horizontal surface contains a given point. Note that both, the polygon as well as the point must share common Z values.
The algorithm accumulates all angles (positive and negative) between neighboring lines that span from a given point to all vertices of the polygon. In case the accumulated absolute value equals 360, the point is located inside the polygon.
- Parameters
polygonPoints (list) – A list of points
point (XYZ) – The point that is tested
- Returns
True, if the polygon contains the point
- Return type
boolean