Scripts

Properties

class properties.AntonPropertyGroup

Bases: bpy.types.PropertyGroup

A class for dynamically defined sets of properties that are defined via Anton_PT_Panel and used across all the operator classes.

Variables:
  • initialized (bool) – Is the problem initialized?
  • forced (bool) – Forces acting on the object has been specified?
  • force_directioned (bool) – Direction for each force has been specified?
  • defined (bool) – Is the problem well-defined?
  • filename (str) – Name of the active-object
  • workspace_path (str) – Path to workspace folder (/tmp/)
  • number_of_forces (int) – Number of forces acting on the object (1)
  • include_fixed (bool) – Add fixed faces to non-design space? (False)
  • include_forced (bool) – Add forced faces to non-design space? (False)
  • density_filter (bool) – Apply a smoothing filter on densities? (False)
  • sensitivity_filter (bool) – Apply a smoothing filter to sensitivity? (True)
  • cl_max (float) – Maximum size of tetrahedral element (0.2)
  • rmin (float) – Radius of neighbourhood (0.2)
  • number_of_neighbours (int) – Number of neighbours (10)
  • density_change (float) – Change in density per iteration (0.2)
  • emin (float) – Minimum allowable value of Young’s modulus (1.0)
  • metaballrad (float) – Radius of metaballs (0.2)
  • metaballsens (float) – Sensitivity of metaballs (0.7)
  • volumina_ratio (float) – Ratio between the design space and solution space (0.4)
  • penalty_exponent (float) – Penalization factor for densities (3.0)
  • number_of_iterations (int) – Number of optimization iterations (30)
  • viz_iteration (int) – Which iteration to visualize? (30)
  • keyframes (int) – Total number of keyframes (30)
  • slices (int) – Number of instantiation points (3)
  • material (enum) – Material of the object (PLA-Generic)

class properties.ForcePropertyGroup

Bases: bpy.types.PropertyGroup

Variables:magnitude (float) – Magnitude of the specified force (1.0N)

Initializer

class initializer.Anton_OT_ForceUpdater

Bases: bpy.types.Operator

execute(context)

Adds NATIVE, FIXED, NODESIGNSPACE and FORCE_{} materials and vertex groups DIRECTION_{} to the active object to facilitate problem definition.

Returns:FINISHED if successful, CANCELLED otherwise

class initializer.Anton_OT_Initializer

Bases: bpy.types.Operator

execute(context)

Design space is defined with existing geometry.

Variables:
  • objects (list) – List of all the obstacle objects
  • points (numpy array of floats) – Bounding points of all the obstacles
  • hull (numpy array of floats) – Convexhull of the bounding points
Returns:

FINISHED if successful, CANCELLED otherwise

Definer

class definer.Anton_OT_Definer

Bases: bpy.types.Operator

execute(context)

Defines the problem after creation of a tetrahedral finite element mesh and stores the mesh variables as a binary numpy file which is accessed by Anton_OT_Processor

Variables:
  • nodes (numpy.array of float) – Cartesian position of nodes
  • elements (numpy.array of int) – Connectivity array of nodes
  • fixed_nodes (numpy.array of int) – Indices of fixed nodes
  • non_design_nodes (numpy.array of int) – Indices of non-design nodes
  • forced_nodes (numpy.array of int) – Indices of forced nodes
  • directions (dict) – Direction vector corresponding to each force
  • distributed_force (dict) – Magnitude per area of each force
Returns:

FINISHED if successful, CANCELLED otherwise

class definer.Anton_OT_DirectionUpdater

Bases: bpy.types.Operator

execute(context)

Instantiates an arrow at the centroid of a face on which force is applied. The instantiated arrow is a grease pencil object whose color corresponds to the applied force. Arrow head flips when direction sign is changed.

Returns:FINISHED if successful, CANCELLED otherwise

Processor

class processor.Anton_OT_Processor

Bases: bpy.types.Operator

execute(context)

Solves the optimization problem defined by nodes, elements, fixed, non_design_nodes, youngs, poisson. Loads the saved numpy variables and computes stiffness matrix with a pyOptFEM vectorized function, solves for displacement and heads on to the optimization loop.

Variables:
  • convergence (float) – Convergence of sensitivity for optimization
  • fixed_elements (numpy.array of int) – Indices of fixed elements
  • forced_elements (numpy.array of int) – Indices of forced elements
  • non_design_set (numpy.array of int) – Non-design space elements
  • edofmat (numpy.array of int) – Element DOF mapping
  • free (numpy.array of int) – Indices of free nodes
  • element_centers (numpy.array of float) – Centroid of each element
  • structure (numpy.array of int) – Neighbourhood of an element
  • distances (numpy.array of float) – Distance to each neighbour
  • volumes (numpy.array of float) – Volume of each element
  • K (numpy.array of float) – Global stiffness matrix
  • F (numpy.array of float) – Force vector
  • displacement (numpy.array of float) – Displacement vector
  • Ue (numpy.array of float) – Element displacement vector
  • densities (numpy.array of float) – Density of each element
  • sensitivity (numpy.array of float) – Sensitivity of each element
  • fdensities (numpy.array of float) – Filtered density vector
  • fsensitivity (numpy.array of float) – Filtered sensitivity vector
Returns:

FINISHED if successful, CANCELLED otherwise

Visualizer

class visualizer.Anton_OT_Visualizer

Bases: bpy.types.Operator

execute(context)

Visualizes the generated outcome with metaballs which are implicit surfaces, meaning that they are not explicitly defined by vertices. Metaballs are instantiated at the centroid of each element with a density value above the specified threshold.

Variables:
  • density_out (float) – Density threshold
  • cdists (numpy.array of float) – Distance to each element’s centroid from origin
  • coms (numpy.array of float) – Center of mass of each slice
Returns:

FINISHED if successful, CANCELLED otherwise