Geometry Containers

The multi module provides specialized geometry containers. A container is a holder object that stores a collection of other objects, i.e. its elements. In NURBS-Python, containers can be generated as a result of

  • A geometric operation, such as splitting
  • File import, e.g. reading a file or a set of files containing multiple surfaces

The multi module contains the following classes:

How to Use

These containers can be used for many purposes, such as visualization of a multi-component geometry or file export. For instance, the following figure shows a heart valve with 3 leaflets:

Figure showing the 3 leaflets of a heart valve as NURBS surfaces

Each leaflet is a NURBS surface added to a SurfaceContainer and rendered via Matplotlib visualization module. It is possible to input a list of colors to the render method, otherwise it will automatically pick an arbitrary color.

Inheritance Diagram

Inheritance diagram of geomdl.multi

Abstract Container

class geomdl.multi.AbstractContainer(*args, **kwargs)

Bases: geomdl.abstract.GeomdlBase

Abstract class for geometry containers.

This class implements Python Iterator Protocol and therefore any instance of this class can be directly used in a for loop.

This class provides the following properties:

add(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
append(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
bbox

Bounding box.

Please refer to the wiki for details on using this class member.

Getter:Gets the bounding box of all contained geometries
data

Returns a dict which contains the geometry data.

Please refer to the wiki for details on using this class member.

delta

Evaluation delta (for all parametric directions).

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta value, smoother the shape.

The following figure illustrates the working principles of the delta property:

\left[{{u_{start}},{u_{start}} + \delta ,({u_{start}} + \delta ) + \delta , \ldots ,{u_{end}}} \right]

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value
Setter:Sets the delta value
dimension

Spatial dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the spatial dimension, e.g. 2D, 3D, etc.
Type:int
evalpts

Evaluated points.

Since there are multiple geometry objects contained in the multi objects, the evaluated points will be returned in the format of list of individual evaluated points which is also a list of Cartesian coordinates.

The following code example illustrates these details:

1
2
3
4
5
6
7
8
multi_obj = multi.SurfaceContainer()  # it can also be multi.CurveContainer()
# Add geometries to multi_obj via multi_obj.add() method
# Then, the following loop will print all the evaluated points of the Multi object
for idx, mpt in enumerate(multi_obj.evalpts):
    print("Shape", idx+1, "contains", len(mpt), "points. These points are:")
    for pt in mpt:
        line = ", ".join([str(p) for p in pt])
        print(line)

Please refer to the wiki for details on using this class member.

Getter:Gets the evaluated points of all contained geometries
id

Object ID (as an integer).

Please refer to the wiki for details on using this class member.

Getter:Gets the object ID
Setter:Sets the object ID
Type:int
name

Object name (as a string)

Please refer to the wiki for details on using this class member.

Getter:Gets the object name
Setter:Sets the object name
Type:str
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property to store custom data inside the geometry object. For instance:

geom.opt = ["face_id", 4]  # creates "face_id" key and sets its value to an integer
geom.opt = ["contents", "data values"]  # creates "face_id" key and sets its value to a string
print(geom.opt)  # will print: {'face_id': 4, 'contents': 'data values'}

del geom.opt  # deletes the contents of the hash map
print(geom.opt)  # will print: {}

geom.opt = ["body_id", 1]  # creates "body_id" key  and sets its value to 1
geom.opt = ["body_id", 12]  # changes the value of "body_id" to 12
print(geom.opt)  # will print: {'body_id': 12}

geom.opt = ["body_id", None]  # deletes "body_id"
print(geom.opt)  # will print: {}

Please refer to the wiki for details on using this class member.

Getter:Gets the dict
Setter:Adds key and value pair to the dict
Deleter:Deletes the contents of the dict
opt_get(value)

Safely query for the value from the opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
pdimension

Parametric dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the parametric dimension
Type:int
render(**kwargs)

Renders plots using the visualization component.

Note

This is an abstract method and it must be implemented in the subclass.

reset()

Resets the cache.

sample_size

Sample size (for all parametric directions).

Sample size defines the number of points to evaluate. It also sets the delta property.

The following figure illustrates the working principles of sample size property:

\underbrace {\left[ {{u_{start}}, \ldots ,{u_{end}}} \right]}_{{n_{sample}}}

Please refer to the wiki for details on using this class member.

Getter:Gets sample size
Setter:Sets sample size
type

Geometry type

Please refer to the wiki for details on using this class member.

Getter:Gets the geometry type
Type:str
vis

Visualization component.

Please refer to the wiki for details on using this class member.

Getter:Gets the visualization component
Setter:Sets the visualization component

Curve Container

class geomdl.multi.CurveContainer(*args, **kwargs)

Bases: geomdl.multi.AbstractContainer

Container class for storing multiple curves.

This class implements Python Iterator Protocol and therefore any instance of this class can be directly used in a for loop.

This class provides the following properties:

The following code example illustrates the usage of the Python properties:

# Create a multi-curve container instance
mcrv = multi.CurveContainer()

# Add single or multi curves to the multi container using mcrv.add() command
# Addition operator, e.g. mcrv1 + mcrv2, also works

# Set the evaluation delta of the multi-curve
mcrv.delta = 0.05

# Get the evaluated points
curve_points = mcrv.evalpts
add(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
append(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
bbox

Bounding box.

Please refer to the wiki for details on using this class member.

Getter:Gets the bounding box of all contained geometries
data

Returns a dict which contains the geometry data.

Please refer to the wiki for details on using this class member.

delta

Evaluation delta (for all parametric directions).

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta value, smoother the shape.

The following figure illustrates the working principles of the delta property:

\left[{{u_{start}},{u_{start}} + \delta ,({u_{start}} + \delta ) + \delta , \ldots ,{u_{end}}} \right]

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value
Setter:Sets the delta value
dimension

Spatial dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the spatial dimension, e.g. 2D, 3D, etc.
Type:int
evalpts

Evaluated points.

Since there are multiple geometry objects contained in the multi objects, the evaluated points will be returned in the format of list of individual evaluated points which is also a list of Cartesian coordinates.

The following code example illustrates these details:

1
2
3
4
5
6
7
8
multi_obj = multi.SurfaceContainer()  # it can also be multi.CurveContainer()
# Add geometries to multi_obj via multi_obj.add() method
# Then, the following loop will print all the evaluated points of the Multi object
for idx, mpt in enumerate(multi_obj.evalpts):
    print("Shape", idx+1, "contains", len(mpt), "points. These points are:")
    for pt in mpt:
        line = ", ".join([str(p) for p in pt])
        print(line)

Please refer to the wiki for details on using this class member.

Getter:Gets the evaluated points of all contained geometries
id

Object ID (as an integer).

Please refer to the wiki for details on using this class member.

Getter:Gets the object ID
Setter:Sets the object ID
Type:int
name

Object name (as a string)

Please refer to the wiki for details on using this class member.

Getter:Gets the object name
Setter:Sets the object name
Type:str
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property to store custom data inside the geometry object. For instance:

geom.opt = ["face_id", 4]  # creates "face_id" key and sets its value to an integer
geom.opt = ["contents", "data values"]  # creates "face_id" key and sets its value to a string
print(geom.opt)  # will print: {'face_id': 4, 'contents': 'data values'}

del geom.opt  # deletes the contents of the hash map
print(geom.opt)  # will print: {}

geom.opt = ["body_id", 1]  # creates "body_id" key  and sets its value to 1
geom.opt = ["body_id", 12]  # changes the value of "body_id" to 12
print(geom.opt)  # will print: {'body_id': 12}

geom.opt = ["body_id", None]  # deletes "body_id"
print(geom.opt)  # will print: {}

Please refer to the wiki for details on using this class member.

Getter:Gets the dict
Setter:Adds key and value pair to the dict
Deleter:Deletes the contents of the dict
opt_get(value)

Safely query for the value from the opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
pdimension

Parametric dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the parametric dimension
Type:int
render(**kwargs)

Renders the curves.

The visualization component must be set using vis property before calling this method.

Keyword Arguments:

  • cpcolor: sets the color of the control points grid
  • evalcolor: sets the color of the surface
  • filename: saves the plot with the input name
  • plot: controls plot window visibility. Default: True
  • animate: activates animation (if supported). Default: False
  • delta: if True, the evaluation delta of the container object will be used. Default: True
  • reset_names: resets the name of the curves inside the container. Default: False

The cpcolor and evalcolor arguments can be a string or a list of strings corresponding to the color values. Both arguments are processed separately, e.g. cpcolor can be a string whereas evalcolor can be a list or a tuple, or vice versa. A single string value sets the color to the same value. List input allows customization over the color values. If none provided, a random color will be selected.

The plot argument is useful when you would like to work on the command line without any window context. If plot flag is False, this method saves the plot as an image file (.png file where possible) and disables plot window popping out. If you don’t provide a file name, the name of the image file will be pulled from the configuration class.

reset()

Resets the cache.

sample_size

Sample size (for all parametric directions).

Sample size defines the number of points to evaluate. It also sets the delta property.

The following figure illustrates the working principles of sample size property:

\underbrace {\left[ {{u_{start}}, \ldots ,{u_{end}}} \right]}_{{n_{sample}}}

Please refer to the wiki for details on using this class member.

Getter:Gets sample size
Setter:Sets sample size
type

Geometry type

Please refer to the wiki for details on using this class member.

Getter:Gets the geometry type
Type:str
vis

Visualization component.

Please refer to the wiki for details on using this class member.

Getter:Gets the visualization component
Setter:Sets the visualization component

Surface Container

class geomdl.multi.SurfaceContainer(*args, **kwargs)

Bases: geomdl.multi.AbstractContainer

Container class for storing multiple surfaces.

This class implements Python Iterator Protocol and therefore any instance of this class can be directly used in a for loop.

This class provides the following properties:

The following code example illustrates the usage of these Python properties:

# Create a multi-surface container instance
msurf = multi.SurfaceContainer()

# Add single or multi surfaces to the multi container using msurf.add() command
# Addition operator, e.g. msurf1 + msurf2, also works

# Set the evaluation delta of the multi-surface
msurf.delta = 0.05

# Get the evaluated points
surface_points = msurf.evalpts
add(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
append(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
bbox

Bounding box.

Please refer to the wiki for details on using this class member.

Getter:Gets the bounding box of all contained geometries
data

Returns a dict which contains the geometry data.

Please refer to the wiki for details on using this class member.

delta

Evaluation delta (for all parametric directions).

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta value, smoother the shape.

The following figure illustrates the working principles of the delta property:

\left[{{u_{start}},{u_{start}} + \delta ,({u_{start}} + \delta ) + \delta , \ldots ,{u_{end}}} \right]

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value
Setter:Sets the delta value
delta_u

Evaluation delta for the u-direction.

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta, smoother the shape.

Please note that delta_u and sample_size_u properties correspond to the same variable with different descriptions. Therefore, setting delta_u will also set sample_size_u.

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value for the u-direction
Setter:Sets the delta value for the u-direction
Type:float
delta_v

Evaluation delta for the v-direction.

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta, smoother the shape.

Please note that delta_v and sample_size_v properties correspond to the same variable with different descriptions. Therefore, setting delta_v will also set sample_size_v.

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value for the v-direction
Setter:Sets the delta value for the v-direction
Type:float
dimension

Spatial dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the spatial dimension, e.g. 2D, 3D, etc.
Type:int
evalpts

Evaluated points.

Since there are multiple geometry objects contained in the multi objects, the evaluated points will be returned in the format of list of individual evaluated points which is also a list of Cartesian coordinates.

The following code example illustrates these details:

1
2
3
4
5
6
7
8
multi_obj = multi.SurfaceContainer()  # it can also be multi.CurveContainer()
# Add geometries to multi_obj via multi_obj.add() method
# Then, the following loop will print all the evaluated points of the Multi object
for idx, mpt in enumerate(multi_obj.evalpts):
    print("Shape", idx+1, "contains", len(mpt), "points. These points are:")
    for pt in mpt:
        line = ", ".join([str(p) for p in pt])
        print(line)

Please refer to the wiki for details on using this class member.

Getter:Gets the evaluated points of all contained geometries
faces

Faces (triangles, quads, etc.) generated by the tessellation operation.

If the tessellation component is set to None, the result will be an empty list.

Getter:Gets the faces
id

Object ID (as an integer).

Please refer to the wiki for details on using this class member.

Getter:Gets the object ID
Setter:Sets the object ID
Type:int
name

Object name (as a string)

Please refer to the wiki for details on using this class member.

Getter:Gets the object name
Setter:Sets the object name
Type:str
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property to store custom data inside the geometry object. For instance:

geom.opt = ["face_id", 4]  # creates "face_id" key and sets its value to an integer
geom.opt = ["contents", "data values"]  # creates "face_id" key and sets its value to a string
print(geom.opt)  # will print: {'face_id': 4, 'contents': 'data values'}

del geom.opt  # deletes the contents of the hash map
print(geom.opt)  # will print: {}

geom.opt = ["body_id", 1]  # creates "body_id" key  and sets its value to 1
geom.opt = ["body_id", 12]  # changes the value of "body_id" to 12
print(geom.opt)  # will print: {'body_id': 12}

geom.opt = ["body_id", None]  # deletes "body_id"
print(geom.opt)  # will print: {}

Please refer to the wiki for details on using this class member.

Getter:Gets the dict
Setter:Adds key and value pair to the dict
Deleter:Deletes the contents of the dict
opt_get(value)

Safely query for the value from the opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
pdimension

Parametric dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the parametric dimension
Type:int
render(**kwargs)

Renders the surfaces.

The visualization component must be set using vis property before calling this method.

Keyword Arguments:
  • cpcolor: sets the color of the control points grids
  • evalcolor: sets the color of the surface
  • filename: saves the plot with the input name
  • plot: controls plot window visibility. Default: True
  • animate: activates animation (if supported). Default: False
  • colormap: sets the colormap of the surfaces
  • delta: if True, the evaluation delta of the container object will be used. Default: True
  • reset_names: resets the name of the surfaces inside the container. Default: False
  • num_procs: number of concurrent processes for rendering the surfaces. Default: 1

The cpcolor and evalcolor arguments can be a string or a list of strings corresponding to the color values. Both arguments are processed separately, e.g. cpcolor can be a string whereas evalcolor can be a list or a tuple, or vice versa. A single string value sets the color to the same value. List input allows customization over the color values. If none provided, a random color will be selected.

The plot argument is useful when you would like to work on the command line without any window context. If plot flag is False, this method saves the plot as an image file (.png file where possible) and disables plot window popping out. If you don’t provide a file name, the name of the image file will be pulled from the configuration class.

Please note that colormap argument can only work with visualization classes that support colormaps. As an example, please see VisMPL.VisSurfTriangle() class documentation. This method expects multiple colormap inputs as a list or tuple, preferable the input list size is the same as the number of surfaces contained in the class. In the case of number of surfaces is bigger than number of input colormaps, this method will automatically assign a random color for the remaining surfaces.

reset()

Resets the cache.

sample_size

Sample size (for all parametric directions).

Sample size defines the number of points to evaluate. It also sets the delta property.

The following figure illustrates the working principles of sample size property:

\underbrace {\left[ {{u_{start}}, \ldots ,{u_{end}}} \right]}_{{n_{sample}}}

Please refer to the wiki for details on using this class member.

Getter:Gets sample size
Setter:Sets sample size
sample_size_u

Sample size for the u-direction.

Sample size defines the number of points to evaluate. It also sets the delta_u property.

Please refer to the wiki for details on using this class member.

Getter:Gets sample size for the u-direction
Setter:Sets sample size for the u-direction
Type:int
sample_size_v

Sample size for the v-direction.

Sample size defines the number of points to evaluate. It also sets the delta_v property.

Please refer to the wiki for details on using this class member.

Getter:Gets sample size for the v-direction
Setter:Sets sample size for the v-direction
Type:int
tessellate(**kwargs)

Tessellates the surfaces inside the container.

Keyword arguments are directly passed to the tessellation component.

The following code snippet illustrates getting the vertices and faces of the surfaces inside the container:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Tessellate the surfaces inside the container
surf_container.tessellate()

# Vertices and faces are stored inside the tessellator component
tsl = surf_container.tessellator

# Loop through all tessellator components
for t in tsl:
    # Get the vertices
    vertices = t.tessellator.vertices
    # Get the faces (triangles, quads, etc.)
    faces = t.tessellator.faces
Keyword Arguments:
  • num_procs: number of concurrent processes for tessellating the surfaces. Default: 1
  • delta: if True, the evaluation delta of the container object will be used. Default: True
  • force: flag to force tessellation. Default: False
tessellator

Tessellation component of the surfaces inside the container.

Please refer to Tessellation documentation for details.

1
2
3
4
5
6
7
8
from geomdl import multi
from geomdl import tessellate

# Create the surface container
surf_container = multi.SurfaceContainer(surf_list)

# Set tessellator component
surf_container.tessellator = tessellate.TrimTessellate()
Getter:gets the tessellation component
Setter:sets the tessellation component
type

Geometry type

Please refer to the wiki for details on using this class member.

Getter:Gets the geometry type
Type:str
vertices

Vertices generated by the tessellation operation.

If the tessellation component is set to None, the result will be an empty list.

Getter:Gets the vertices
vis

Visualization component.

Please refer to the wiki for details on using this class member.

Getter:Gets the visualization component
Setter:Sets the visualization component

Volume Container

class geomdl.multi.VolumeContainer(*args, **kwargs)

Bases: geomdl.multi.AbstractContainer

Container class for storing multiple volumes.

This class implements Python Iterator Protocol and therefore any instance of this class can be directly used in a for loop.

This class provides the following properties:

The following code example illustrates the usage of these Python properties:

# Create a multi-volume container instance
mvol = multi.VolumeContainer()

# Add single or multi volumes to the multi container using mvol.add() command
# Addition operator, e.g. mvol1 + mvol2, also works

# Set the evaluation delta of the multi-volume
mvol.delta = 0.05

# Get the evaluated points
volume_points = mvol.evalpts
add(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
append(element)

Adds geometry objects to the container.

The input can be a single geometry, a list of geometry objects or a geometry container object.

Parameters:element – geometry object
bbox

Bounding box.

Please refer to the wiki for details on using this class member.

Getter:Gets the bounding box of all contained geometries
data

Returns a dict which contains the geometry data.

Please refer to the wiki for details on using this class member.

delta

Evaluation delta (for all parametric directions).

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta value, smoother the shape.

The following figure illustrates the working principles of the delta property:

\left[{{u_{start}},{u_{start}} + \delta ,({u_{start}} + \delta ) + \delta , \ldots ,{u_{end}}} \right]

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value
Setter:Sets the delta value
delta_u

Evaluation delta for the u-direction.

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta, smoother the shape.

Please note that delta_u and sample_size_u properties correspond to the same variable with different descriptions. Therefore, setting delta_u will also set sample_size_u.

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value for the u-direction
Setter:Sets the delta value for the u-direction
Type:float
delta_v

Evaluation delta for the v-direction.

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta, smoother the shape.

Please note that delta_v and sample_size_v properties correspond to the same variable with different descriptions. Therefore, setting delta_v will also set sample_size_v.

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value for the v-direction
Setter:Sets the delta value for the v-direction
Type:float
delta_w

Evaluation delta for the w-direction.

Evaluation delta corresponds to the step size. Decreasing the step size results in evaluation of more points. Therefore; smaller the delta, smoother the shape.

Please note that delta_w and sample_size_w properties correspond to the same variable with different descriptions. Therefore, setting delta_w will also set sample_size_w.

Please refer to the wiki for details on using this class member.

Getter:Gets the delta value for the w-direction
Setter:Sets the delta value for the w-direction
Type:float
dimension

Spatial dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the spatial dimension, e.g. 2D, 3D, etc.
Type:int
evalpts

Evaluated points.

Since there are multiple geometry objects contained in the multi objects, the evaluated points will be returned in the format of list of individual evaluated points which is also a list of Cartesian coordinates.

The following code example illustrates these details:

1
2
3
4
5
6
7
8
multi_obj = multi.SurfaceContainer()  # it can also be multi.CurveContainer()
# Add geometries to multi_obj via multi_obj.add() method
# Then, the following loop will print all the evaluated points of the Multi object
for idx, mpt in enumerate(multi_obj.evalpts):
    print("Shape", idx+1, "contains", len(mpt), "points. These points are:")
    for pt in mpt:
        line = ", ".join([str(p) for p in pt])
        print(line)

Please refer to the wiki for details on using this class member.

Getter:Gets the evaluated points of all contained geometries
id

Object ID (as an integer).

Please refer to the wiki for details on using this class member.

Getter:Gets the object ID
Setter:Sets the object ID
Type:int
name

Object name (as a string)

Please refer to the wiki for details on using this class member.

Getter:Gets the object name
Setter:Sets the object name
Type:str
opt

Dictionary for storing custom data in the current geometry object.

opt is a wrapper to a dict in key => value format, where key is string, value is any Python object. You can use opt property to store custom data inside the geometry object. For instance:

geom.opt = ["face_id", 4]  # creates "face_id" key and sets its value to an integer
geom.opt = ["contents", "data values"]  # creates "face_id" key and sets its value to a string
print(geom.opt)  # will print: {'face_id': 4, 'contents': 'data values'}

del geom.opt  # deletes the contents of the hash map
print(geom.opt)  # will print: {}

geom.opt = ["body_id", 1]  # creates "body_id" key  and sets its value to 1
geom.opt = ["body_id", 12]  # changes the value of "body_id" to 12
print(geom.opt)  # will print: {'body_id': 12}

geom.opt = ["body_id", None]  # deletes "body_id"
print(geom.opt)  # will print: {}

Please refer to the wiki for details on using this class member.

Getter:Gets the dict
Setter:Adds key and value pair to the dict
Deleter:Deletes the contents of the dict
opt_get(value)

Safely query for the value from the opt property.

Parameters:value (str) – a key in the opt property
Returns:the corresponding value, if the key exists. None, otherwise.
pdimension

Parametric dimension.

Please refer to the wiki for details on using this class member.

Getter:Gets the parametric dimension
Type:int
render(**kwargs)

Renders the volumes.

The visualization component must be set using vis property before calling this method.

Keyword Arguments:
  • cpcolor: sets the color of the control points plot
  • evalcolor: sets the color of the volume
  • filename: saves the plot with the input name
  • plot: controls plot window visibility. Default: True
  • animate: activates animation (if supported). Default: False
  • delta: if True, the evaluation delta of the container object will be used. Default: True
  • reset_names: resets the name of the volumes inside the container. Default: False
  • grid_size: grid size for voxelization. Default: (16, 16, 16)
  • num_procs: number of concurrent processes for voxelization. Default: 1

The cpcolor and evalcolor arguments can be a string or a list of strings corresponding to the color values. Both arguments are processed separately, e.g. cpcolor can be a string whereas evalcolor can be a list or a tuple, or vice versa. A single string value sets the color to the same value. List input allows customization over the color values. If none provided, a random color will be selected.

The plot argument is useful when you would like to work on the command line without any window context. If plot flag is False, this method saves the plot as an image file (.png file where possible) and disables plot window popping out. If you don’t provide a file name, the name of the image file will be pulled from the configuration class.

reset()

Resets the cache.

sample_size

Sample size (for all parametric directions).

Sample size defines the number of points to evaluate. It also sets the delta property.

The following figure illustrates the working principles of sample size property:

\underbrace {\left[ {{u_{start}}, \ldots ,{u_{end}}} \right]}_{{n_{sample}}}

Please refer to the wiki for details on using this class member.

Getter:Gets sample size
Setter:Sets sample size
sample_size_u

Sample size for the u-direction.

Sample size defines the number of points to evaluate. It also sets the delta_u property.

Please refer to the wiki for details on using this class member.

Getter:Gets sample size for the u-direction
Setter:Sets sample size for the u-direction
Type:int
sample_size_v

Sample size for the v-direction.

Sample size defines the number of points to evaluate. It also sets the delta_v property.

Please refer to the wiki for details on using this class member.

Getter:Gets sample size for the v-direction
Setter:Sets sample size for the v-direction
Type:int
sample_size_w

Sample size for the w-direction.

Sample size defines the number of points to evaluate. It also sets the delta_w property.

Please refer to the wiki for details on using this class member.

Getter:Gets sample size for the w-direction
Setter:Sets sample size for the w-direction
Type:int
type

Geometry type

Please refer to the wiki for details on using this class member.

Getter:Gets the geometry type
Type:str
vis

Visualization component.

Please refer to the wiki for details on using this class member.

Getter:Gets the visualization component
Setter:Sets the visualization component