import sys, os sheets = forms.select_sheets() if not sheets: sys.exit() dwg = DWG() dirs = [] max_value = len(sheets) counter = 1 with forms.ProgressBar( title='Exporting DWG ... ({value} of {max_value})') as pb: for sheet in sheets: counter = counter + 1 path = dwg.export(sheet) if path: dirs.append(os.path.dirname(path)) else: script.get_output().print_html( ':pouting_face: Error exporting <em>{}</em>'.format( os.path.basename(path))) pb.update_progress(counter, max_value) dirs = list(set(dirs)) for d in dirs: script.show_folder_in_explorer(d)
import revitron from revitron import _ from revitronui import DWG from pyrevit import script from pyrevit import forms import sys, os sheet = revitron.ACTIVE_VIEW if _(sheet).getClassName() == 'ViewSheet': dwg = DWG() path = dwg.export(sheet) if path: script.get_output().print_html( ':smiling_face: Exported <em>{}</em>'.format( os.path.basename(path))) script.show_folder_in_explorer(os.path.dirname(path)) else: script.get_output().print_html( ':pouting_face: Error exporting <em>{}</em>'.format( os.path.basename(path)))
"""Print the full path to the central model (if model is workshared). Shift+Click: Open central model path in file browser """ #pylint: disable=E0401,invalid-name import os.path as op from pyrevit import revit from pyrevit import forms from pyrevit import script if forms.check_workshared(doc=revit.doc): central_path = revit.query.get_central_path(doc=revit.doc) if __shiftclick__: #pylint: disable=E0602 script.show_folder_in_explorer(op.dirname(central_path)) else: print(central_path)