40. properties — General framework for attributing properties to geometrical elements. — pyFormex v0.8.6 documentation

### Navigation

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

# 40. `properties` — General framework for attributing properties to geometrical elements.

Properties can really be just about any Python object. Properties can be attributed to a set of geometrical elements.

`Classes defined in module properties`

class `properties.` `Database`(data={})

  A class for storing properties in a database.

  `readDatabase`(filename, *args, **kargs)

    Import all records from a database file.

    For now, it can only read databases using flatkeydb. args and kargs can be used to specify arguments for the FlatDB constructor.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `MaterialDB`(data={})

  A class for storing material properties.

  `readDatabase`(filename, *args, **kargs)

    Import all records from a database file.

    For now, it can only read databases using flatkeydb. args and kargs can be used to specify arguments for the FlatDB constructor.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `SectionDB`(data={})

  A class for storing section properties.

  `readDatabase`(filename, *args, **kargs)

    Import all records from a database file.

    For now, it can only read databases using flatkeydb. args and kargs can be used to specify arguments for the FlatDB constructor.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `ElemSection`(section=None, material=None, orientation=None, behavior=None, **kargs)

  Properties related to the section of an element.

  An element section property can hold the following sub-properties:

  section

    the geometric properties of the section. This can be a dict or a string. If it is a string, its value is looked up in the global section database. The required data in the dict depend on the sectiontype. Currently the following keys are used by fe_abq.py:

    sectiontype

      the type of section: should be one of following:

      - ‘solid’: a solid 2D or 3D section,
      - ‘circ’ : a plain circular section,
      - ‘rect’ : a plain rectangular section,
      - ‘pipe’ : a hollow circular section,
      - ‘box’ : a hollow rectangular section,
      - ‘I’ : an I-beam,
      - ‘general’ : anything else (automatically set if not specified).

      !! Currently only ‘solid’ and ‘general’ are allowed.

    - the cross section characteristics : cross_section, moment_inertia_11, moment_inertia_12, moment_inertia_22, torsional_constant
    - for sectiontype ‘circ’: radius
  material
    the element material. This can be a dict or a string. Currently known keys to fe_abq.py are: young_modulus, shear_modulus, density, poisson_ratio . (see fmtMaterial in fe_abq)
  orientation
    - a Dict, or
    - a list of 3 direction cosines of the first beam section axis.
  behavior
    the behavior of a connector
  `addSection`(section)

    Create or replace the section properties of the element.

    If ‘section’ is a dict, it will be added to ‘self.secDB’. If ‘section’ is a string, this string will be used as a key to search in ‘self.secDB’.

  `computeSection`(section)

    Compute the section characteristics of specific sections.

  `addMaterial`(material)

    Create or replace the material properties of the element.

    If the argument is a dict, it will be added to ‘self.matDB’. If the argument is a string, this string will be used as a key to search in ‘self.matDB’.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `ElemLoad`(label=None, value=None)

  Distributed loading on an element.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `EdgeLoad`(edge=-1, label=None, value=None)

  Distributed loading on an element edge.

  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `properties.` `CoordSystem`(csys, cdata)

  A class for storing coordinate systems.

class `properties.` `Amplitude`(data, definition='TABULAR')

  A class for storing an amplitude.

  The amplitude is a list of tuples (time,value).

class `properties.` `PropertyDB`

  A database class for all properties.

  This class collects all properties that can be set on a geometrical model.

  This should allow for storing:

  - materials
  - sections
  - any properties
  - node properties
  - elem properties
  - model properties (current unused: use unnamed properties)
  `setMaterialDB`(aDict)

    Set the materials database to an external source

  `setSectionDB`(aDict)

    Set the sections database to an external source

  `Prop`(kind='', tag=None, set=None, name=None, **kargs)

    Create a new property, empty by default.

    A property can hold almost anything, just like any Dict type. It has however four predefined keys that should not be used for anything else than explained hereafter:

    - nr: a unique id, that never should be set/changed by the user.
    - tag: an identification tag used to group properties
    - name: the name to be used for this set. Default is to use an automatically generated name.
    - set: identifies the geometrical elements for which the defined properties will hold. This can be either:
      - a single number,
      - a list of numbers,
      - the name of an already defined set,
      - a list of such names.

    Besides these, any other fields may be defined and will be added without checking.

  `getProp`(kind='', rec=None, tag=None, attr=[], noattr=[], delete=False)

    Return all properties of type kind matching tag and having attr.

    kind is either ‘’, ‘n’, ‘e’ or ‘m’ If rec is given, it is a list of record numbers or a single number. If a tag or a list of tags is given, only the properties having a matching tag attribute are returned.

    attr and noattr are lists of attributes. Only the properties having all the attributes in attr and none of the properties in noattr are returned. Attributes whose value is None are treated as non-existing.

    If delete==True, the returned properties are removed from the database.

  `delProp`(kind='', rec=None, tag=None, attr=[])

    Delete properties.

    This is equivalent to getProp() but the returned properties are removed from the database.

  `nodeProp`(prop=None, set=None, name=None, tag=None, cload=None, bound=None, displ=None, veloc=None, accel=None, csys=None, ampl=None, **kargs)

    Create a new node property, empty by default.

    A node property can contain any combination of the following fields:

    - tag: an identification tag used to group properties (this is e.g. used to flag Step, increment, load case, ...)
    - set: a single number or a list of numbers identifying the node(s) for which this property will be set, or a set name If None, the property will hold for all nodes.
    - cload: a concentrated load: a list of 6 float values [FX,FY,FZ,MX,MY,MZ] or a list of (dofid,value) tuples.
    - displ,veloc,accel: prescribed displacement, velocity or acceleration: a list of 6 float values [UX,UY,UZ,RX,RY,RZ] or a list of tuples (dofid,value)
    - bound: a boundary condition: a str or a list of 6 codes (0/1)
    - csys: a CoordSystem
    - ampl: the name of an Amplitude
  `elemProp`(prop=None, grp=None, set=None, name=None, tag=None, section=None, eltype=None, dload=None, eload=None, ampl=None, **kargs)

    Create a new element property, empty by default.

    An elem property can contain any combination of the following fields:

    - tag: an identification tag used to group properties (this is e.g. used to flag Step, increment, load case, ...)
    - set: a single number or a list of numbers identifying the element(s) for which this property will be set, or a set name If None, the property will hold for all elements.
    - grp: an elements group number (default None). If specified, the element numbers given in set are local to the specified group. If not, elements are global and should match the global numbering according to the order in which element groups will be specified in the Model.
    - eltype: the element type (currently in Abaqus terms).
    - section: an ElemSection specifying the element section properties.
    - dload: an ElemLoad specifying a distributed load on the element.
    - ampl: the name of an Amplitude
  `update`(data={})

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

`Functions defined in module properties`

`properties.` `checkIdValue`(values)

  Check that a variable is a list of (id,value) tuples

  id should be convertible to an int, value to a float. If ok, return the values as a list of (int,float) tuples.

`properties.` `checkArrayOrIdValue`(values)

  Check that a variable is an list of values or (id,value) tuples

  This convenience function checks that the argument is either:

  - a list of 6 float values (or convertible to it), or
  - a list of (id,value) tuples where id is convertible to an int, value to a float.

  If ok, return the values as a list of (int,float) tuples.

`properties.` `checkString`(a, valid)

  Check that a string a has one of the valid values.

  This is case insensitive, and returns the upper case string if valid. Else, an error is raised.

`properties.` `FindListItem`(l, p)

  Find the item p in the list l.

  If p is an item in the list (not a copy of it!), this returns its position. Else, -1 is returned.

  Matches are found with a ‘is’ function, not an ‘==’. Only the first match will be reported.

`properties.` `RemoveListItem`(l, p)

  Remove the item p from the list l.

  If p is an item in the list (not a copy of it!), it is removed from the list. Matches are found with a ‘is’ comparison. This is different from the normal Python list.remove() method, which uses ‘==’. As a result, we can find complex objects which do not allow ‘==’, such as ndarrays.

### Navigation

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