def create_sheet(sheet_num, sheet_name, titleblock): sheet_num = str(sheet_num) new_datasheet = DB.ViewSheet.Create(revit.doc, titleblock) new_datasheet.Name = sheet_name while get_sheet(sheet_num): sheet_num = coreutils.increment_str(sheet_num, 1) new_datasheet.SheetNumber = str(sheet_num) return new_datasheet
def increment(number): """Increment given item number by one.""" return coreutils.increment_str(number, expand=True)
'to Verbose in pyRevit settings.' logger = script.get_logger() selection = revit.get_selection() shift = 1 selected_sheets = forms.select_sheets(title='Select Sheets') if not selected_sheets: script.exit() sorted_sheet_list = sorted(selected_sheets, key=lambda x: x.SheetNumber) if shift >= 0: sorted_sheet_list.reverse() with revit.Transaction('Shift Sheets'): for sheet in sorted_sheet_list: try: cur_sheet_num = sheet.SheetNumber sheet_num_param = sheet.Parameter[DB.BuiltInParameter.SHEET_NUMBER] sheet_num_param.Set( coreutils.increment_str(sheet.SheetNumber, shift)) new_sheet_num = sheet.SheetNumber logger.info('{} -> {}'.format(cur_sheet_num, new_sheet_num)) except Exception as shift_err: logger.error(shift_err) revit.doc.Regenerate()
def increment(number): return coreutils.increment_str(number, expand=True)