"""Tag all chosen element types in all views.""" #pylint: disable=C0103,E0401,C0111,W0703 from pyrevit import revit, DB from pyrevit import forms from pyrevit import script logger = script.get_logger() output = script.get_output() # makr a cross shape line1 = DB.Line.CreateBound(DB.XYZ(-1, -1, 0), DB.XYZ(1, 1, 0)) line2 = DB.Line.CreateBound(DB.XYZ(1, -1, 0), DB.XYZ(-1, 1, 0)) # place lines on active view try: with revit.Transaction('Place Origin Marker', log_errors=False): if revit.doc.IsFamilyDocument: revit.doc.FamilyCreate.NewDetailCurve(revit.activeview, line1) revit.doc.FamilyCreate.NewDetailCurve(revit.activeview, line2) else: revit.doc.Create.NewDetailCurve(revit.activeview, line1) revit.doc.Create.NewDetailCurve(revit.activeview, line2) except Exception as ex: forms.alert("You are not on a plan view.", sub_msg=str(ex))
.WhereElementIsNotElementType()\ .ToElements() all_sheets = sorted(sheetsnotsorted, key=lambda x: x.SheetNumber) # collect all clouds all_clouds = DB.FilteredElementCollector(revit.doc)\ .OfCategory(DB.BuiltInCategory.OST_RevisionClouds)\ .WhereElementIsNotElementType() # collect all revisions all_revisions = DB.FilteredElementCollector(revit.doc)\ .OfCategory(DB.BuiltInCategory.OST_Revisions)\ .WhereElementIsNotElementType() console = script.get_output() console.set_height(800) console.lock_size() report_title = 'Revision Report' report_date = coreutils.current_date() report_project = revit.get_project_info().name # setup element styling console.add_style( 'table { border-collapse: collapse; width:100% }' 'table, th, td { border-bottom: 1px solid #aaa; padding: 5px;}' 'th { background-color: #545454; color: white; }' 'tr:nth-child(odd) {background-color: #f2f2f2}') # Print Title and Report Info
def print_header(header): output = script.get_output() output.insert_divider() output.print_md('### {}'.format(header))
clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI') clr.AddReference("System") from Autodesk.Revit.UI import * from Autodesk.Revit.DB import * clr. AddReferenceByPartialName('PresentationCore') clr.AddReferenceByPartialName('PresentationFramework') clr.AddReferenceByPartialName('System.Windows.Forms') uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document __doc__ = 'Print a warning summary including warning types and counts.'\ ' This is helpful check model health' outprint = script.get_output() output = pyrevit.output.get_output() tab = ' ' # input --------------------- cate = [] if revit.doc.IsWorkshared: warnings = doc.GetWarnings() cateCount = 1 cate = [] print('Below are all warning categories: ' + str(len(warnings))) for i in warnings: categories = i.GetDescriptionText().ToString() if not categories in cate: cate.append(categories) for text in cate: count = 0
from pyrevit import script from collections import defaultdict config = revitron.DocumentConfigStorage().get('revitron.export', defaultdict()) setup = config.get('DWG_Export_Setup') exporter = revitron.DWGExporter(setup) sheets = revitron.Selection().get() if not sheets: sheets = [revitron.ACTIVEVIEW] dirs = [] for sheet in sheets: path = exporter.exportSheet(sheet, config.get('Sheet_Export_Directory'), config.get('Sheet_Naming_Template')) if path: dirs.append(os.path.dirname(path)) script.get_output().print_html( ':smiling_face: Exported <em>{}</em>'.format( os.path.basename(path))) else: script.get_output().print_html( ':pouting_face: Error exporting <em>{}</em>'.format( os.path.basename(path))) dirs = list(set(dirs)) for d in dirs: script.show_folder_in_explorer(d)
def printTitle(): out = script.get_output() out.print_html('<h2>Revitron Package Manager</h2>')