def _make_canvas_unique_id(): return 'chart{}'.format(timestamp())
"""Saves current selection memory as a Selection Filter.""" import os import os.path as op import pickle as pl from pyrevit.coreutils import timestamp from pyrevit import revit, DB from pyrevit import script proj_info = revit.get_project_info() datafile = script.get_document_data_file("SelList", "pym") if op.exists(datafile): if proj_info.name: filtername = 'SavedSelection_' + proj_info.name + '_' + timestamp() else: filtername = 'SavedSelection_' + timestamp() with open(datafile, 'r') as f: cursel = pl.load(f) with revit.Transaction('pySaveSelection'): selFilter = DB.SelectionFilterElement.Create(revit.doc, filtername) for elid in cursel: selFilter.AddSingle(DB.ElementId(int(elid)))
"""Saves current selection memory as a Selection Filter.""" import os import os.path as op import pickle as pl from pyrevit.coreutils import timestamp from revitutils import doc from Autodesk.Revit.DB import Transaction from Autodesk.Revit.DB import ElementId from Autodesk.Revit.DB import SelectionFilterElement usertemp = os.getenv('Temp') prjname = op.splitext(op.basename(doc.PathName))[0] datafile = usertemp + '\\' + prjname + '_pySaveRevitSelection.pym' f = open(datafile, 'r') cursel = pl.load(f) f.close() filtername = 'SavedSelection_' + prjname + '_' + timestamp() t = Transaction(doc, 'pySaveSelection') t.Start() selFilter = SelectionFilterElement.Create(doc, filtername) for elid in cursel: selFilter.AddSingle(ElementId(int(elid))) t.Commit()
import pickle as pl from pyrevit import coreutils from pyrevit import revit, DB from pyrevit import script logger = script.get_logger() proj_info = revit.query.get_project_info() data_file = script.get_document_data_file("SelList", "pym") logger.debug(data_file) if op.exists(data_file): if proj_info.name: filter_name = \ 'SavedSelection_' + proj_info.name + '_' + coreutils.timestamp() else: filter_name = \ 'SavedSelection_' + coreutils.timestamp() with open(data_file, 'r') as f: cursel = pl.load(f) with revit.Transaction('pySaveSelection'): selection_filter = \ DB.SelectionFilterElement.Create( revit.doc, coreutils.cleanup_filename(filter_name) ) for elid in cursel: selection_filter.AddSingle(DB.ElementId(int(elid)))