Freeform Geometry

Added in version 5.2.

freeform module provides classes for representing freeform geometry objects.

Freeform class provides a basis for storing freeform geometries. The points of the geometry can be set via the evaluate() method using a keyword argument.

Inheritance Diagram

digraph inheritance912f2c5cc5 { bgcolor=transparent; rankdir=LR; ratio=compress; size="8.0, 12.0"; "geomdl.abstract.Geometry" [URL="module_abstract.html#geomdl.abstract.Geometry",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for defining geometry objects."]; "geomdl.freeform.Freeform" [URL="#geomdl.freeform.Freeform",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="n-dimensional freeform geometry"]; "geomdl.abstract.Geometry" -> "geomdl.freeform.Freeform" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Class Reference

class geomdl.freeform.Freeform(**kwargs)

Bases: Geometry

n-dimensional freeform geometry

property data

Returns a dict which contains the geometry data.

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

property 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

property evalpts

Evaluated points.

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

Getter:

Gets the coordinates of the evaluated points

Type:

list

evaluate(**kwargs)

Sets points that form the geometry.

Keyword Arguments:
  • points: sets the points

property 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

property 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

property 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.

property type

Geometry type

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

Getter:

Gets the geometry type

Type:

str