Example #1
0
def pickbycategory(catname):
    try:
        msfilter = PickByCategorySelectionFilter(catname)
        selection_list = revit.pick_rectangle(pick_filter=msfilter)
        filtered_list = []
        for el in selection_list:
            filtered_list.append(el.Id)
        selection.set_to(filtered_list)
    except Exception:
        pass
Example #2
0
def pick_by_category(category_opt):
    try:
        selection = revit.get_selection()
        msfilter = PickByCategorySelectionFilter(category_opt)
        selection_list = revit.pick_rectangle(pick_filter=msfilter)
        filtered_list = []
        for element in selection_list:
            filtered_list.append(element.Id)
        selection.set_to(filtered_list)
    except Exception as err:
        logger.debug(err)
Example #3
0
def pickbycategory(catname):
    msfilter = PickByCategorySelectionFilter(catname)
    selection_list = revit.pick_rectangle(pick_filter=msfilter)
    return selection_list
Example #4
0
class MassSelectionFilter(UI.Selection.ISelectionFilter):
    # standard API override function
    def AllowElement(self, element):
        if element.ViewSpecific:
            if not isinstance(element, DB.Group) \
                    and element.GroupId != element.GroupId.InvalidElementId:
                return False
            else:
                return True
        else:
            return False

    # standard API override function
    def AllowReference(self, refer, point):
        return False


try:
    msfilter = MassSelectionFilter()
    selection_list = revit.pick_rectangle(pick_filter=msfilter)

    filtered_list = []
    for el in selection_list:
        filtered_list.append(el.Id)

    selection.set_to(filtered_list)
    revit.uidoc.RefreshActiveView()
except Exception:
    pass