pytabs.select
1# pyTABS - ETABS .NET API python wrapper 2# Select - cSelect 3__all__ = ['Select'] 4 5# import ETABS namespace and pyTABS error handler 6from pytabs.etabs_config import * 7from pytabs.error_handle import * 8 9# import custom enumerations 10from pytabs.enumerations import eSelectObjectType 11 12 13# import typing 14from typing import TypedDict 15 16class SelectedObjects(TypedDict): 17 """TypedDict class for get_selected return""" 18 number_items : int 19 object_types : list[eSelectObjectType] 20 object_names : list[str] 21 22 23class Select: 24 """Select interface""" 25 def __init__(self, sap_model : etabs.cSapModel) -> None: 26 # link of SapModel interface 27 self.sap_model = sap_model 28 # create SelectObj interface 29 self.select = etabs.cSelect(sap_model.SelectObj) 30 31 # relate custom enumerations 32 self.eSelectObjectType = eSelectObjectType 33 34 35 def all(self, deselect : bool = False) -> None: 36 """Selects or deselects all objects in the model. 37 38 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 39 :type deselect: bool, optional 40 """ 41 handle(self.select.All(deselect)) 42 43 44 def clear_selection(self) -> None: 45 """Deselects all objects in the model. 46 """ 47 handle(self.select.ClearSelection()) 48 49 50 def get_selected(self) -> SelectedObjects: 51 """Retrieves a list of selected objects. 52 53 :return: Quantity, Type and Names of the selected objects 54 :rtype: `SelectedObjects` 55 """ 56 number_items = int() 57 object_types = [int()] 58 object_names = [str()] 59 [ret, number_items, object_types, object_names] = self.select.GetSelected(number_items, object_types, object_names) 60 handle(ret) 61 return {'number_items': number_items, 62 'object_types': [eSelectObjectType(o) for o in object_types], 63 'object_names': list(object_names)} 64 65 66 def group(self, name : str, deselect : bool = False) -> None: 67 """Selects or deselects all objects in the specified group. 68 69 :param name: The name of an existing group 70 :type name: str 71 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 72 :type deselect: bool, optional 73 """ 74 handle(self.select.Group(name, deselect)) 75 76 77 def invert_selection(self) -> None: 78 """Deselects all selected objects and selects all unselected objects; that is, it inverts the selection. 79 """ 80 handle(self.select.InvertSelection()) 81 82 83 def previous_selection(self) -> None: 84 """Restores the previous selection. 85 """ 86 handle(self.select.PreviousSelection())
class
Select:
24class Select: 25 """Select interface""" 26 def __init__(self, sap_model : etabs.cSapModel) -> None: 27 # link of SapModel interface 28 self.sap_model = sap_model 29 # create SelectObj interface 30 self.select = etabs.cSelect(sap_model.SelectObj) 31 32 # relate custom enumerations 33 self.eSelectObjectType = eSelectObjectType 34 35 36 def all(self, deselect : bool = False) -> None: 37 """Selects or deselects all objects in the model. 38 39 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 40 :type deselect: bool, optional 41 """ 42 handle(self.select.All(deselect)) 43 44 45 def clear_selection(self) -> None: 46 """Deselects all objects in the model. 47 """ 48 handle(self.select.ClearSelection()) 49 50 51 def get_selected(self) -> SelectedObjects: 52 """Retrieves a list of selected objects. 53 54 :return: Quantity, Type and Names of the selected objects 55 :rtype: `SelectedObjects` 56 """ 57 number_items = int() 58 object_types = [int()] 59 object_names = [str()] 60 [ret, number_items, object_types, object_names] = self.select.GetSelected(number_items, object_types, object_names) 61 handle(ret) 62 return {'number_items': number_items, 63 'object_types': [eSelectObjectType(o) for o in object_types], 64 'object_names': list(object_names)} 65 66 67 def group(self, name : str, deselect : bool = False) -> None: 68 """Selects or deselects all objects in the specified group. 69 70 :param name: The name of an existing group 71 :type name: str 72 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 73 :type deselect: bool, optional 74 """ 75 handle(self.select.Group(name, deselect)) 76 77 78 def invert_selection(self) -> None: 79 """Deselects all selected objects and selects all unselected objects; that is, it inverts the selection. 80 """ 81 handle(self.select.InvertSelection()) 82 83 84 def previous_selection(self) -> None: 85 """Restores the previous selection. 86 """ 87 handle(self.select.PreviousSelection())
Select interface
def
all(self, deselect: bool = False) -> None:
36 def all(self, deselect : bool = False) -> None: 37 """Selects or deselects all objects in the model. 38 39 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 40 :type deselect: bool, optional 41 """ 42 handle(self.select.All(deselect))
Selects or deselects all objects in the model.
Parameters
- deselect:
False
if objects are to be selected andTrue
if they are to be deselected, defaults to False
def
clear_selection(self) -> None:
45 def clear_selection(self) -> None: 46 """Deselects all objects in the model. 47 """ 48 handle(self.select.ClearSelection())
Deselects all objects in the model.
def
get_selected(self) -> pytabs.select.SelectedObjects:
51 def get_selected(self) -> SelectedObjects: 52 """Retrieves a list of selected objects. 53 54 :return: Quantity, Type and Names of the selected objects 55 :rtype: `SelectedObjects` 56 """ 57 number_items = int() 58 object_types = [int()] 59 object_names = [str()] 60 [ret, number_items, object_types, object_names] = self.select.GetSelected(number_items, object_types, object_names) 61 handle(ret) 62 return {'number_items': number_items, 63 'object_types': [eSelectObjectType(o) for o in object_types], 64 'object_names': list(object_names)}
Retrieves a list of selected objects.
Returns
Quantity, Type and Names of the selected objects
def
group(self, name: str, deselect: bool = False) -> None:
67 def group(self, name : str, deselect : bool = False) -> None: 68 """Selects or deselects all objects in the specified group. 69 70 :param name: The name of an existing group 71 :type name: str 72 :param deselect: `False` if objects are to be selected and `True` if they are to be deselected, defaults to False 73 :type deselect: bool, optional 74 """ 75 handle(self.select.Group(name, deselect))
Selects or deselects all objects in the specified group.
Parameters
- name: The name of an existing group
- deselect:
False
if objects are to be selected andTrue
if they are to be deselected, defaults to False
def
invert_selection(self) -> None:
78 def invert_selection(self) -> None: 79 """Deselects all selected objects and selects all unselected objects; that is, it inverts the selection. 80 """ 81 handle(self.select.InvertSelection())
Deselects all selected objects and selects all unselected objects; that is, it inverts the selection.