### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >

# 52. `objects` — Selection of objects from the global dictionary.

This is a support module for other pyFormex plugins.

`Classes defined in module objects`

class `objects.``Objects`(clas=None, like=None, filter=None, namelist=[])

  A selection of objects from the pyFormex Globals().

  The class provides facilities to filter the global objects by their type and select one or more objects by their name(s). The values of these objects can be changed and the changes can be undone.

  `object_type`()

    Return the type of objects in this selection.

  `set`(names)

    Set the selection to a list of names.

    namelist can be a single object name or a list of names. This will also store the current values of the variables.

  `append`(name, value=None)

    Add a name,value to a selection.

    If no value is given, its current value is used. If a value is given, it is exported.

  `clear`()

    Clear the selection.

  `listAll`()

    Return a list with all selectable objects.

    This lists all the global names in pyformex.PF that match the class and/or filter (if specified).

  `remember`(copy=False)

    Remember the current values of the variables in selection.

    If copy==True, the values are copied, so that the variables’ current values can be changed inplace without affecting the remembered values.

  `changeValues`(newvalues)

    Replace the current values of selection by new ones.

    The old values are stored locally, to enable undo operations.

    This is only needed to change the values of objects that can not be changed inplace!

  `undoChanges`()

    Undo the last changes of the values.

  `check`(single=False, warn=True)

    Check that we have a current selection.

    Returns the list of Objects corresponding to the current selection. If single==True, the selection should hold exactly one Object name and a single Object instance is returned. If there is no selection, or more than one in case of single==True, an error message is displayed and None is returned

  `odict`()

    Return the currently selected items as a dictionary.

    Returns an ODict with the currently selected objects in the order of the selection.names.

  `ask`(mode='multi')

    Show the names of known objects and let the user select one or more.

    mode can be set to’single’ to select a single item. Return a list with the selected names, possibly empty (if nothing was selected by the user), or None if there is nothing to choose from. This also sets the current selection to the selected names, unless the return value is None, in which case the selection remains unchanged.

  `ask1`()

    Select a single object from the list.

    Returns the object, not its name!

  `forget`()

    Remove the selection from the globals.

  `keep`()

    Remove everything except the selection from the globals.

  `printval`()

    Print the selection.

  `printbbox`()

    Print the bbox of the current selection.

  `writeToFile`(filename)

    Write objects to a geometry file.

  `readFromFile`(filename)

    Read objects from a geometry file.

class `objects.``DrawableObjects`(*args, **kargs)

  A selection of drawable objects from the globals().

  This is a subclass of Objects. The constructor has the same arguments as the Objects class, plus the following:

  - annotations: a set of functions that draw annotations of the objects. Each function should take an object name as argument, and draw the requested annotation for the named object. If the object does not have the annotation, it should be silently ignored. Default annotation functions available are:

    - draw_object_name
    - draw_elem_numbers
    - draw_nodes
    - draw_node_numbers
    - draw_bbox

    No annotation functions are activated by default.

  `ask`(mode='multi')

    Interactively sets the current selection.

  `drawChanges`()

    Draws old and new version of a Formex with different colors.

    old and new can be a either Formex instances or names or lists thereof. old are drawn in yellow, new in the current color.

  `undoChanges`()

    Undo the last changes of the values.

  `toggleAnnotation`(f, onoff=None)

    Toggle the display of an annotation On or Off.

    If given, onoff is True or False. If no onoff is given, this works as a toggle.

  `drawAnnotation`(f)

    Draw some annotation for the current selection.

  `removeAnnotation`(f)

    Remove the annotation f.

  `hasAnnotation`(f)

    Return the status of annotation f

  `setProp`(prop=None)

    Set the property of the current selection.

    prop should be a single integer value or None. If None is given, a value will be asked from the user. If a negative value is given, the property is removed. If a selected object does not have a setProp method, it is ignored.

  `delProp`()

    Delete the property of the current selection.

    This well reset the prop attribute of all selected objects to None.

  `object_type`()

    Return the type of objects in this selection.

  `set`(names)

    Set the selection to a list of names.

    namelist can be a single object name or a list of names. This will also store the current values of the variables.

  `append`(name, value=None)

    Add a name,value to a selection.

    If no value is given, its current value is used. If a value is given, it is exported.

  `clear`()

    Clear the selection.

  `listAll`()

    Return a list with all selectable objects.

    This lists all the global names in pyformex.PF that match the class and/or filter (if specified).

  `remember`(copy=False)

    Remember the current values of the variables in selection.

    If copy==True, the values are copied, so that the variables’ current values can be changed inplace without affecting the remembered values.

  `changeValues`(newvalues)

    Replace the current values of selection by new ones.

    The old values are stored locally, to enable undo operations.

    This is only needed to change the values of objects that can not be changed inplace!

  `check`(single=False, warn=True)

    Check that we have a current selection.

    Returns the list of Objects corresponding to the current selection. If single==True, the selection should hold exactly one Object name and a single Object instance is returned. If there is no selection, or more than one in case of single==True, an error message is displayed and None is returned

  `odict`()

    Return the currently selected items as a dictionary.

    Returns an ODict with the currently selected objects in the order of the selection.names.

  `ask1`()

    Select a single object from the list.

    Returns the object, not its name!

  `forget`()

    Remove the selection from the globals.

  `keep`()

    Remove everything except the selection from the globals.

  `printval`()

    Print the selection.

  `printbbox`()

    Print the bbox of the current selection.

  `writeToFile`(filename)

    Write objects to a geometry file.

  `readFromFile`(filename)

    Read objects from a geometry file.

`Functions defined in module objects`

`objects.``draw_object_name`(n)

  Draw the name of an object at its center.

`objects.``draw_elem_numbers`(n)

  Draw the numbers of an object’s elements.

`objects.``draw_nodes`(n)

  Draw the nodes of an object.

`objects.``draw_node_numbers`(n)

  Draw the numbers of an object’s nodes.

`objects.``draw_free_edges`(n)

  Draw the feature edges of an object.

`objects.``draw_bbox`(n)

  Draw the bbox of an object.

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >