The Selection toolset

The Selection toolset provides a selection capability outside of any procedure. In other words, it allows users to select objects and then invoke a procedure, instead of invoking the procedure and then selecting the objects.

Each module defines a set of entities that can be selected in that module. If you create your own module, then you should set the appropriate selectable entities when your module gets activated. You can use the getToolset method of the main window to get the selection toolset, and then use the setFilterTypes method of the selection toolset.

  • setFilterTypes(types, defaultType)

Use the following flags for the types and defaultType arguments:

  • SELECTION_FILTER_NONE

  • SELECTION_FILTER_ALL

  • SELECTION_FILTER_VERTEX

  • SELECTION_FILTER_EDGE

  • SELECTION_FILTER_FACE

  • SELECTION_FILTER_CELL

  • SELECTION_FILTER_DATUM

  • SELECTION_FILTER_REF_POINT

  • SELECTION_FILTER_NODE

  • SELECTION_FILTER_ELEMENT

  • SELECTION_FILTER_FEATURE

For example:

class MyModuleGui(AFXModuleGui):

    ...

    def activate(self):

        toolset = getAFXApp().getAFXMainWindow().getToolset(
            'Selection')
        toolset.setFilterTypes(
            SELECTION_FILTER_CELL|SELECTION_FILTER_FACE, 
            SELECTION_FILTER_FACE)
        AFXModuleGui.activate(self)