Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Titleblock on sheets #1276

Merged
merged 4 commits into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,46 @@
logger = script.get_logger()


def get_source_sheets():
sheet_elements = forms.select_sheets(
button_name="List TitleBlocks",
use_selection=True,
include_placeholder=False,
)
if not sheet_elements:
script.exit()
return sheet_elements


def print_titleblocks(sheets):
all_tblocks = []
for sheet in sheets:
tblocks = revit.query.get_sheet_tblocks(sheet)
all_tblocks.extend([x.Id for x in tblocks])
for tblock in tblocks:
print(
"SHEET: {0} - {1}\t\tTITLEBLOCK: {2} {3}".format(
sheet.SheetNumber,
sheet.Name,
tblock.Name,
output.linkify(tblock.Id),
)
)
print(
"{}".format(output.linkify(all_tblocks, title="Select All TitleBlocks"))
)


"""Select title blocks on selected sheets for batch editing."""
# pylint: disable=import-error,invalid-name,broad-except,superfluous-parens
from pyrevit import revit
from pyrevit import forms
from pyrevit import script

output = script.get_output()
logger = script.get_logger()


def get_source_sheets():
sheet_elements = forms.select_sheets(
button_name="List TitleBlocks",
Expand Down Expand Up @@ -39,4 +79,13 @@ def print_titleblocks(sheets):


# orchestrate
print_titleblocks(get_source_sheets())
if __shiftclick__:
selection = revit.get_selection()
sheets = get_source_sheets()
all_tblocks = []
for sheet in sheets:
tblocks = revit.query.get_sheet_tblocks(sheet)
all_tblocks.extend([x.Id for x in tblocks])
selection.set_to(all_tblocks)
else:
print_titleblocks(get_source_sheets())