revitron.create¶
The create
submodule and its Create
class contain helpful shorthand methods to create
Revit elements and families programatically. For example a centered room tag can be created as follows:
tag = revitron.Create.roomTag(self.element, self.getBboxCenter())
Note that some methods are also directly accessible in element classes such as Room
:
tag = _(room).tagCenter()
Classes:
|
A collection of shorthand methods to create Revit elements. |
- class Create[source]¶
Bases:
object
A collection of shorthand methods to create Revit elements.
Methods:
GridLineLinear
(start, end, name)Create a new linear grid line.
familyDoc
(template, savePath)Creates a new familiy document from a given template and saves it.add()
familyExtrusion
(familyDoc, curveArrayArray, ...)Creates an extrusion within a given family document.
familyInstance
(familySymbolId, location[, ...])Creates a new family instance.
roomTag
(room, location[, typeId, viewId])Creates a room tag for a given room element.
view3D
()Create a new 3D view.
- static GridLineLinear(start, end, name)[source]¶
Create a new linear grid line.
- Parameters
start (object) – A Revit
XYZ
elementend (object) – A Revit
XYZ
elementname (string) – The grid name
- Returns
A Revit grid element
- Return type
object
- static familyDoc(template, savePath)[source]¶
Creates a new familiy document from a given template and saves it.add()
- Parameters
template (string) – The template name without the
.rft
extension.savePath (string) – The full path of the family file to be saved as.
- Returns
A reference to the newly created family document.
- Return type
object
- static familyExtrusion(familyDoc, curveArrayArray, sketchPlane, height=10.0, location=False, isSolid=True)[source]¶
Creates an extrusion within a given family document.
- Parameters
familyDoc (object) – A reference to a family document.
curveArrayArray (object) – A Revit API
CurveArrArray
.sketchPlane (object) – A Revit API
SketchPlane
.height (float, optional) – The extrusion height. Defaults to 10.0.
location (object, optional) – A Revit API
XYZ
point object. Defaults to False.isSolid (bool, optional) – Soild (True) or void (False). Defaults to True.
- Returns
The extrusion element.
- Return type
object
- static familyInstance(familySymbolId, location, structuralType=False, view=None)[source]¶
Creates a new family instance.
Example:
transaction = revitron.Transaction() instance = revitron.Create.familyInstance(familySymbolId, location) transaction.commit()
- Parameters
familySymbolId (object) – A Revit API family symbol ID.
location (object) – A Revit API
XYZ
point.structuralType (object, optional) – A Revit API structural type of False for
NonStructural
. Defaults to False.view (object, optional) – A Revit view, Defaults to None. Note that
structuralType
andview
can not be used together.
- Returns
The family instance.
- Return type
object
- static roomTag(room, location, typeId=False, viewId=False)[source]¶
Creates a room tag for a given room element.
- Parameters
room (object) – A Revit room element
location (object) – A Revit point object
typeId (ElementId, optional) – An optional Id of a tag type. Defaults to False.
viewId (ElementId, optional) – An optional Id of a view. Defaults to the currently active view.
- Returns
The Revit
RoomTag
element- Return type
object