create
Database objects creation functions.
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
Classes
FamilyLoaderOptionsHandler(overwriteParameterValues=True)
Bases: IFamilyLoadOptions
Family loader options handler.
Source code in pyrevitlib/pyrevit/revit/db/create.py
Functions
OnFamilyFound(familyInUse, overwriteParameterValues)
A method called when the family was found in the target document.
OnSharedFamilyFound(sharedFamily, familyInUse, source, overwriteParameterValues)
Source code in pyrevitlib/pyrevit/revit/db/create.py
CopyUseDestination
Bases: IDuplicateTypeNamesHandler
Handle copy and paste errors.
Functions
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)
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!
Changed
Previously returned bool (True on success, False on failure). Now returns list[DB.FamilySymbol] (non-empty list on success, empty list on failure). The return value is still truthy/falsy compatible for boolean checks.
Improved behavior: If family is already loaded, the function now retrieves and returns the existing family's symbols instead of returning an empty list.
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
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
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |