GeometryObject Class

class plask.geometry.GeometryObject

Base class for all geometry objects.

Methods

get_matching_objects(cond)

Get list of the geometry tree objects matching condition.

get_role_objects(role)

Get list of the geometry tree objects that have the specified role.

modify_objects(callable)

Modify all objects in the geometry tree.

validate()

Check if the object is complete and ready for calculations.

Attributes

dims

Number of object's dimensions (int, 2 or 3).

steps

Step info for mesh generation for non-uniform objects.

Descriptions

Method Details

GeometryObject.get_matching_objects(cond)

Get list of the geometry tree objects matching condition.

This method returns all the objects in the geometry tree that match the specified condition.

Parameters:

cond – Python callable that accepts a geometry object and returns Boolean indicating whether the object should be returned by this method or not.

Returns:

List of objects matching your condition.

Return type:

sequence

GeometryObject.get_role_objects(role)

Get list of the geometry tree objects that have the specified role.

This method returns all the objects in the geometry tree that have the specified role.

Warning

This method will return the very object with the role specified and not its items, which is against the normal behavior of the roles.

Parameters:

role (str) – Role to search objects with.

Returns:

List of objects matching your condition.

Return type:

sequence

GeometryObject.modify_objects(callable)

Modify all objects in the geometry tree.

This method calls callable on every object in the geometry tree. The callable takes a single geometry object as an argument and should return None (in which case nothing happens), a new object to replace the original one, or an empty tuple (which will result in the removal of the original object).

Parameters:

callable – a callable filtering each object in the tree

Returns:

modified geometry

Return type:

GeometryObject

GeometryObject.validate()

Check if the object is complete and ready for calculations.

This method is specific for a particular object. It raises an exception if the object definition is somehow incomplete.

Attribute Details

GeometryObject.dims = <property object>

Number of object’s dimensions (int, 2 or 3).

GeometryObject.steps = <property object>

Step info for mesh generation for non-uniform objects.

This parameter is considered only for the non-uniform leafs in the geometry tree. It has two attributes that can be changed:

num

Maximum number of the mesh steps in each direction the object is divided into.

dist

Minimum step size.

The exact meaning of these attributes depend on the mesh generator, however in general they indicate how densely should the non-uniform object be subdivided.

It is possible to assign simply an integer number to this parameter, in which case it changes its num attribute.