def clear(self): """ Clears Selection >>> selection = Selection() >>> selection.clear() Returns: None """ ElementSet.clear(self) self.update()
def add(self, elements_or_ids, select=True): """ Adds elements to selection. Args: elements ([DB.Element or DB.ElementID]): Elements or ElementIds >>> selection = Selection() >>> selection.add(SomeElement) >>> selection.add([elements]) >>> selection.add([element_ids]) """ # Call Set for proper adding into set. ElementSet.add(self, elements_or_ids) if select: self.update()
def __init__(self, elements_or_ids=None, uidoc=revit.uidoc): """ Initializes Selection. Elements or ElementIds are optional. If no elements are provided on intiialization, selection handler will be created with selected elements. Args: elements ([DB.Element or DB.ElementID]): Elements or ElementIds >>> selection = Selection(SomeElement) >>> selection = Selection(SomeElementId) >>> selection = Selection([Element, Element, Element, ...]) """ BaseObjectWrapper.__init__(self, uidoc.Selection) self.uidoc = uidoc if not elements_or_ids: # Is List of elements is not provided, uses uidoc selection elements_or_ids = [e for e in uidoc.Selection.GetElementIds()] ElementSet.__init__(self, elements_or_ids, doc=self.uidoc.Document)
def process_value(cls, element_references): element_set = ElementSet(element_references) return DB.ExclusionFilter(element_set.as_element_id_list)