create
Database objects creation functions.
The model, view and drawing helpers accept points as DB.XYZ or
(x, y[, z]) tuples, and lengths as feet or as strings that
units.parse_length reads, such as 32'-6" or 900mm.
Note
Every helper that changes the document must be called inside a transaction.
Attributes
mlogger = get_logger(__name__)
module-attribute
PARAM_VALUE_EVALUATORS = {'startswith': (DB.FilterStringBeginsWith, DB.FilterStringBeginsWith), 'contains': (DB.FilterStringContains, DB.FilterStringContains), 'endswith': (DB.FilterStringEndsWith, DB.FilterStringEndsWith), '==': (DB.FilterStringEquals, DB.FilterNumericEquals), '>': (DB.FilterStringGreater, DB.FilterNumericGreater), '>=': (DB.FilterStringGreaterOrEqual, DB.FilterNumericGreaterOrEqual), '<': (DB.FilterStringLess, DB.FilterNumericLess), '<=': (DB.FilterStringLessOrEqual, DB.FilterNumericLessOrEqual)}
module-attribute
ELEVATION_SIDES = {'south': (0.0, -1.0), 'north': (0.0, 1.0), 'east': (1.0, 0.0), 'west': (-1.0, 0.0)}
module-attribute
SHEET_ANCHORS = ('top_left', 'top_right', 'bottom_left', 'bottom_right', 'center')
module-attribute
Classes
FamilyLoaderOptionsHandler(overwriteParameterValues=True)
Bases: IFamilyLoadOptions
Family loader options handler.
Source code in pyrevitlib/pyrevit/revit/db/create.py
Methods:
OnFamilyFound(familyInUse, overwriteParameterValues)
A method called when the family was found in the target document.
The interface declares ref parameters: IronPython passes a StrongBox to mutate; pythonnet expects the updated values returned in a tuple after the return value.
Source code in pyrevitlib/pyrevit/revit/db/create.py
OnSharedFamilyFound(sharedFamily, familyInUse, source, overwriteParameterValues)
Source code in pyrevitlib/pyrevit/revit/db/create.py
CopyUseDestination
Bases: IDuplicateTypeNamesHandler
Handle copy and paste errors.
Methods:
OnDuplicateTypeNamesFound(args)
Functions:
create_param_from_definition(param_def, category_list, builtin_param_group, type_param=False, allow_vary_betwen_groups=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_shared_param(param_id_or_name, category_list, builtin_param_group, type_param=False, allow_vary_betwen_groups=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_new_project(template=None, imperial=True)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_revision(description=None, by=None, to=None, date=None, alphanum=False, nonum=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
copy_elements(element_ids, src_doc, dest_doc, return_ids=False)
Source code in pyrevitlib/pyrevit/revit/db/create.py
copy_revisions(revisions, src_doc, dest_doc)
Source code in pyrevitlib/pyrevit/revit/db/create.py
copy_all_revisions(src_doc, dest_doc)
copy_viewtemplates(viewtemplates, src_doc, dest_doc)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_sheet(sheet_num, sheet_name, titleblock_id=DB.ElementId.InvalidElementId, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_3d_view(view_name, isometric=True, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_revision_sheetset(revisions, name_format='Revision {}', match_any=True, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
load_family(family_file, doc=None)
Loads Family from specified file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_file
|
str
|
Required. Fully qualified filename of the Family file, usually ending in .rfa. |
required |
doc
|
Document
|
Optional. If not specified DOCS.doc used. |
None
|
Returns:
| Type | Description |
|---|---|
|
list[DB.FamilySymbol]: list of all Family symbols. Returns symbols whether the family |
|
|
was just loaded or already existed in the document. Returns empty list only if the |
|
|
family file cannot be loaded and the family is not found in the document. |
WARNING! This function MUST be used within a transaction!
Important
A non-empty list does not prove Revit loaded the file; it can contain
symbols from a matching family already in the document. Call
:func:load_family_with_result when the direct Revit load result is
required.
Example
from pyrevit.revit.db import create, transaction
family_path = r"C:\Families\MyFamily.rfa" with transaction.Transaction('Load Family'): symbols = create.load_family(family_path) if symbols: print("Found {} symbol(s)".format(len(symbols))) for symbol in symbols: print(" - {}".format(symbol.Family.Name)) else: print("Family file not found or failed to load")
Source code in pyrevitlib/pyrevit/revit/db/create.py
load_family_with_result(family_file, doc=None)
Load a family and return Revit's result with its available symbols.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_file
|
str
|
Fully qualified path to the family file. |
required |
doc
|
Document
|
Target document. Defaults to the active document. |
None
|
Returns:
| Type | Description |
|---|---|
|
tuple[bool, list[DB.FamilySymbol]]: The direct Revit load result and |
|
|
symbols from the loaded or matching existing family. |
Important
A false result can still include symbols when Revit refuses the file because a matching family is already present. Callers that report an overwrite must use the boolean result rather than symbol-list truthiness.
Source code in pyrevitlib/pyrevit/revit/db/create.py
load_family_symbol(family_file, symbol_name, doc=None)
Load one family symbol through the engine-specific out-param bridge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_file
|
str
|
Fully qualified path to the family file. |
required |
symbol_name
|
str
|
Family type name to load. |
required |
doc
|
Document
|
Target document. Defaults to the active document. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True when Revit loads the requested symbol. |
Important
The caller must have an open Revit transaction.
Source code in pyrevitlib/pyrevit/revit/db/create.py
enable_worksharing(levels_workset_name='Shared Levels and Grids', default_workset_name='Workset1', doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_workset(workset_name, doc=None)
create_filledregion(filledregion_name, fillpattern_element, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_text_type(name, font_name=None, font_size=0.01042, tab_size=0.02084, bold=False, italic=False, underline=False, width_factor=1.0, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_param_value_filter(filter_name, param_id, param_values, evaluator, match_any=True, case_sensitive=False, exclude=False, category_list=None, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/create.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | |
to_xyz(point, z=None)
Return a DB.XYZ from an XYZ or an (x, y[, z]) tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
XYZ | tuple
|
point; tuple values may be length strings. |
required |
z
|
float
|
elevation that replaces the point's own Z. |
None
|
Returns:
| Type | Description |
|---|---|
XYZ
|
the point. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
rectangle_points(x1, y1, x2, y2)
Return the corners of an axis-aligned rectangle, counter-clockwise.
The two points may be any pair of opposite corners; the corners are returned from the south-west one. Edge 0 is the south edge, edge 1 the east, edge 2 the north and edge 3 the west; the roof functions refer to edges by index.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_curve_loop(points, z=0.0)
Return a closed DB.CurveLoop of lines through points at elevation z.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_curve_array(points, z=0.0, closed=True)
Return a DB.CurveArray of lines through points at elevation z.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_wall(start, end, wall_type, level=None, height=10.0, top_level=None, base_offset=0.0, structural=False, doc=None)
Create a straight wall along its location line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
XYZ | tuple
|
location line start (plan point). |
required |
end
|
XYZ | tuple
|
location line end. |
required |
wall_type
|
WallType | str
|
wall type or its name. |
required |
level
|
Level | str
|
base level, defaults to the active plan's level or the lowest level. |
None
|
height
|
float | str
|
unconnected height. |
10.0
|
top_level
|
Level | str
|
make the top follow this level instead of an unconnected height. |
None
|
base_offset
|
float | str
|
offset from the base level. |
0.0
|
structural
|
bool
|
structural wall. |
False
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Wall
|
the wall. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when no transaction is open, or a name doesn't match (the message lists the valid names). |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_walls(points, wall_type, level=None, height=10.0, closed=True, top_level=None, doc=None)
Create walls along a polyline, one wall per pair of consecutive points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list
|
plan points as DB.XYZ or (x, y) tuples. |
required |
wall_type
|
WallType | str
|
wall type or its name. |
required |
level
|
Level | str
|
base level, defaults as in create_wall. |
None
|
height
|
float | str
|
unconnected height. |
10.0
|
closed
|
bool
|
also join the last point to the first. |
True
|
top_level
|
Level | str
|
make the tops follow this level. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
list[Wall]
|
walls, in the order of the points. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_profile_wall(profile_points, wall_type, level=None, structural=False, doc=None)
Create a wall from a closed outline drawn in its vertical plane.
For walls that aren't rectangles in elevation, such as gable ends, stepped parapets or walls under a sloped ceiling. The wall is native, so it keeps its type's layers and materials, joins, and hosts openings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_points
|
list
|
(x, y, z) points of the outline, in order, not repeating the first; all in one vertical plane. The first two points should be the bottom edge. |
required |
wall_type
|
WallType | str
|
wall type or its name. |
required |
level
|
Level | str
|
level the wall is associated with, defaults as in create_wall. Elevations in the points are absolute. |
None
|
structural
|
bool
|
structural wall. |
False
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Wall
|
the wall. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when the points aren't in one vertical plane. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_gable_wall(start, end, wall_type, eave_height, pitch=None, ridge_height=None, level=None, doc=None)
Create a gable end wall: rectangular to the eave, triangular above it.
Use it for the end walls under a gable roof on Revit versions where walls can't attach to roofs (update.attach_wall_tops), instead of filling the gable with DirectShape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
XYZ | tuple
|
plan point at one eave end of the wall. |
required |
end
|
XYZ | tuple
|
plan point at the other eave end. |
required |
wall_type
|
WallType | str
|
wall type or its name. |
required |
eave_height
|
float | str
|
height of the wall's two eave corners above the level. |
required |
pitch
|
float | str
|
roof pitch ( |
None
|
ridge_height
|
float | str
|
height of the peak above the level, at the wall's midpoint. |
None
|
level
|
Level | str
|
base level, defaults as in create_wall. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Wall
|
the wall. |
Note
The rake follows the roof's slope from the wall's own ends. A roof
whose eave outline overhangs the wall sits higher over the wall by
overhang * pitch; add that to eave_height to close the gap.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_floor(points, floor_type, level=None, offset=0.0, structural=False, doc=None)
Create a floor on a closed outline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list
|
outline plan points, in order, not repeating the first. |
required |
floor_type
|
FloorType | str
|
floor type or its name. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
offset
|
float | str
|
height above the level. |
0.0
|
structural
|
bool
|
structural floor. |
False
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Floor
|
the floor. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_ceiling(points, ceiling_type, level=None, offset=8.0, doc=None)
Create a ceiling on a closed outline (Revit 2022 and later).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list
|
outline plan points. |
required |
ceiling_type
|
CeilingType | str
|
ceiling type or its name. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
offset
|
float | str
|
height above the level. |
8.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Ceiling
|
the ceiling. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_footprint_roof(points, roof_type, level=None, slopes=None, offset=0.0, doc=None)
Create a footprint roof with slopes on chosen edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list
|
eave outline plan points, overhangs included. |
required |
roof_type
|
RoofType | str
|
roof type or its name. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
slopes
|
dict
|
edge index to pitch, where edge |
None
|
offset
|
float | str
|
eave height above the level. |
0.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[FootPrintRoof, list[ModelCurve]]
|
the roof and the |
|
model curve of each footprint edge. |
Note
Calls NewFootPrintRoof through reflection with a pre-filled argument array, because IronPython 3.4 passes null for its out parameter and Revit rejects null.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_gable_roof(x1, y1, x2, y2, roof_type, pitch, ridge='x', level=None, offset=0.0, doc=None)
Create a rectangular gable roof and check its rise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float | str
|
eave outline corner X, overhangs included. |
required |
y1
|
float | str
|
eave outline corner Y. |
required |
x2
|
float | str
|
opposite corner X. |
required |
y2
|
float | str
|
opposite corner Y. |
required |
roof_type
|
RoofType | str
|
roof type or its name. |
required |
pitch
|
float | str
|
|
required |
ridge
|
str
|
|
'x'
|
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
offset
|
float | str
|
eave height above the level. |
0.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
FootPrintRoof
|
the roof. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when the built roof's rise doesn't match the pitch, which means the slopes landed on the wrong edges. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_hip_roof(x1, y1, x2, y2, roof_type, pitch, level=None, offset=0.0, doc=None)
Create a rectangular hip roof, the same pitch on all four edges; see create_gable_roof.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_shed_roof(x1, y1, x2, y2, roof_type, pitch, low_side='south', level=None, offset=0.0, doc=None)
Create a rectangular shed roof sloping down toward one side, and check its rise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float | str
|
eave outline corner X, overhangs included. |
required |
y1
|
float | str
|
eave outline corner Y. |
required |
x2
|
float | str
|
opposite corner X. |
required |
y2
|
float | str
|
opposite corner Y. |
required |
roof_type
|
RoofType | str
|
roof type or its name. |
required |
pitch
|
float | str
|
|
required |
low_side
|
str
|
south, east, north or west. |
'south'
|
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
offset
|
float | str
|
height of the low eave above the level. |
0.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
FootPrintRoof
|
the roof. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
place_hosted_instance(symbol, host, point, level=None, sill_height=None, doc=None)
Place a door, window or other hosted family on a host such as a wall.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
FamilySymbol | str
|
family type or its name; activated when needed. |
required |
host
|
Element
|
host element, usually a wall. |
required |
point
|
XYZ | tuple
|
plan point on the host's location line. |
required |
level
|
Level | str
|
level, defaults to the host's level. |
None
|
sill_height
|
float | str
|
sill height for windows. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
FamilyInstance
|
the instance. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
place_family_instance(symbol, point, level=None, structural_type=None, rotation=0.0, doc=None)
Place a level-based family instance such as furniture, fixtures or columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
FamilySymbol | str
|
family type or its name; activated when needed. |
required |
point
|
XYZ | tuple
|
plan insertion point. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
structural_type
|
StructuralType
|
defaults to NonStructural. |
None
|
rotation
|
float
|
rotation in degrees around the insertion point. |
0.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
FamilyInstance
|
the instance. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_column(symbol, point, level=None, top_level=None, structural=True, doc=None)
Place a column from level up to top_level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
FamilySymbol | str
|
column type or its name. |
required |
point
|
XYZ | tuple
|
plan insertion point. |
required |
level
|
Level | str
|
base level, defaults as in create_wall. |
None
|
top_level
|
Level | str
|
top level; must be above the base. Adjust heights afterwards with FAMILY_BASE_LEVEL_OFFSET_PARAM and FAMILY_TOP_LEVEL_OFFSET_PARAM. |
None
|
structural
|
bool
|
structural column (else architectural). |
True
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
FamilyInstance
|
the column. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when the top level isn't above the base level, which would make a zero-height column. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_room(point, level=None, name=None, number=None, require_enclosed=True, doc=None)
Place a room at a plan point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
XYZ | UV | tuple
|
plan point inside the room. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
name
|
str
|
room name. |
None
|
number
|
str
|
room number. |
None
|
require_enclosed
|
bool
|
raise when the room isn't enclosed. Placing rooms right after the walls is a cheap check for gaps in a layout. |
True
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Room
|
the room. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_room_separation_lines(points, level=None, view=None, closed=False, doc=None)
Create room separation lines, to divide an open plan without walls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list
|
plan points of the polyline. |
required |
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
view
|
ViewPlan
|
plan view to create them in, defaults to a floor plan of the level. |
None
|
closed
|
bool
|
also join the last point to the first. |
False
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
list[ModelCurve]
|
the separation lines. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_model_lines(points, level=None, closed=False, doc=None)
Create model lines along a polyline at a level's elevation.
Returns:
| Type | Description |
|---|---|
list[ModelCurve]
|
the model lines. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
unique_view_name(view_name, doc=None)
Return view_name, or "view_name (2)" and so on if it is taken.
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_plan_view(level=None, view_name=None, plan_type='floor', template=None, doc=None)
Create a floor, ceiling or structural plan of a level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
Level | str
|
level, defaults as in create_wall. |
None
|
view_name
|
str
|
name, made unique; defaults to
|
None
|
plan_type
|
str
|
floor, ceiling or structural. |
'floor'
|
template
|
str | View
|
view template to apply. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
ViewPlan
|
the view. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_model_3d_view(view_name=None, direction='southeast', elements=None, model_only=True, template=None, doc=None)
Create a new isometric 3D view framed on elements or the whole model.
Unlike create_3d_view, which reuses a view with the same name, this always creates a view (with a unique name), hides annotation and fits a section box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
name, made unique; defaults to "3D". |
None
|
direction
|
str
|
where the viewer stands: southeast, southwest, northeast, northwest, south, north, east, west, top. |
'southeast'
|
elements
|
list
|
elements to frame with the section box; defaults to query.get_model_elements(). |
None
|
model_only
|
bool
|
hide levels, grids and annotation, whose extents otherwise dwarf the model in the view. |
True
|
template
|
str | View
|
view template to apply. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
View3D
|
the view. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_section_view(start, end, view_name=None, bottom=None, top=None, depth=10.0, template=None, doc=None)
Create a section along a plan line, looking to the left of start -> end.
A line drawn west to east looks north.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
XYZ | tuple
|
section line start. |
required |
end
|
XYZ | tuple
|
section line end. |
required |
view_name
|
str
|
name, made unique; defaults to "Section". |
None
|
bottom
|
float | str
|
bottom elevation, defaults to 1 ft below the lowest level. |
None
|
top
|
float | str
|
top elevation, defaults to 10 ft above the highest level. |
None
|
depth
|
float | str
|
far clip distance. |
10.0
|
template
|
str | View
|
view template to apply. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
ViewSection
|
the view. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_elevation_view(side='south', view_name=None, plan=None, offset=10.0, template=None, doc=None)
Create an exterior elevation of the whole model seen from one side.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side
|
str
|
south, north, east or west. |
'south'
|
view_name
|
str
|
name, made unique; defaults to
|
None
|
plan
|
ViewPlan | str
|
plan to host the marker, defaults to a floor plan of the lowest level. |
None
|
offset
|
float | str
|
distance of the marker outside the model's extents. |
10.0
|
template
|
str | View
|
view template to apply. |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
ViewSection
|
the elevation view. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | |
create_dimension(view, references, axis='x', position=0.0, doc=None)
Create a linear dimension through references in a plan view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
View
|
view to draw the dimension in. |
required |
references
|
list[Reference]
|
at least two references, such as face references from query.get_face_references. |
required |
axis
|
str
|
|
'x'
|
position
|
float | str
|
where the dimension line sits. |
0.0
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Dimension
|
the dimension. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
with fewer than two references, an unknown axis, or a model with no elements to span. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
tag_elements(view, elements, offset=0.0, tag_type=None, leader=False, doc=None)
Tag elements by category in a view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
View
|
view to tag in. |
required |
elements
|
list[Element]
|
elements to tag. |
required |
offset
|
float | str
|
move each tag this far along the element's facing direction (doors and windows); negative moves it the other way, into the room. |
0.0
|
tag_type
|
FamilySymbol | str
|
tag type or its name; defaults to the category's default tag. |
None
|
leader
|
bool
|
draw a leader. |
False
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
list[IndependentTag]
|
the tags. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_room_tags(view, rooms=None, tag_type=None, doc=None)
Tag rooms at their location points in a plan view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
ViewPlan
|
plan view. |
required |
rooms
|
list[Room]
|
rooms to tag, defaults to the placed rooms visible in the view. |
None
|
tag_type
|
FamilySymbol | str
|
room tag type or its name,
such as |
None
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
list[RoomTag]
|
the tags. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
create_schedule(category, fields, view_name=None, sort_by=None, totals=None, itemized=True, grand_total=True, doc=None)
Create a schedule of a category with the named fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str | BuiltInCategory | Category
|
category, such as
|
required |
fields
|
list[str]
|
field names in column order, as shown in Revit's
schedule properties ( |
required |
view_name
|
str
|
schedule name, made unique. |
None
|
sort_by
|
list[str]
|
field names to sort by, in order. A
field missing from |
None
|
totals
|
list[str]
|
numeric fields to total. A field
missing from |
None
|
itemized
|
bool
|
list every element instead of grouping. |
True
|
grand_total
|
bool
|
show a grand total row with a count. |
True
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
ViewSchedule
|
the schedule. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when a field name isn't schedulable for the category; the message lists the available fields. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | |
place_on_sheet(sheet, view, anchor='top_left', margin=0.1, doc=None)
Place a view or schedule on a sheet, aligned to a corner of the title block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
ViewSheet
|
sheet. |
required |
view
|
View | ViewSchedule
|
view or schedule to place. A view can be on one sheet only; schedules can repeat. |
required |
anchor
|
str
|
top_left, top_right, bottom_left, bottom_right or center of the title block (the sheet outline when it has none). |
'top_left'
|
margin
|
float | str
|
gap between the placed box and the title block edge, in sheet feet (0.1 ft is 1.2 in). |
0.1
|
doc
|
Document
|
document, defaults to the active one. |
None
|
Returns:
| Type | Description |
|---|---|
Viewport | ScheduleSheetInstance
|
the placed viewport or |
|
schedule instance. |
Raises:
| Type | Description |
|---|---|
PyRevitException
|
when the view can't be added to the sheet, for example because it is already on another sheet. |
Source code in pyrevitlib/pyrevit/revit/db/create.py
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | |