foldable_robotics package

Subpackages

Submodules

foldable_robotics.class_algebra module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

class foldable_robotics.class_algebra.ClassAlgebra[source]

Bases: object

This class is used to map standard Python operators to specific function names, making it easy for any child to implement CSG-like functionality

foldable_robotics.dxf module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

foldable_robotics.dxf.calc_circle(p1, p2, bulge, arc_approx=0)[source]

Approximates an arc betweem two points using a “bulge value”.

Parameters
  • p1 (tuple of floats) – the starting point.

  • p2 (tuple of floats) – the ending point.

  • bulge (int) – the bulge value. Positive bulge is right of the segment, negative is left.

  • arc_approx (int) – number of interior points to approximate an arc with

Return type

List of two-coordinate tuples.

foldable_robotics.dxf.get_types(filename, model_type)[source]

return all of the dxf items of type “type”

Parameters
  • filename (string) – path to the dxf.

  • model_type (string) – model type you are looking for. ex: ‘LWPOLYLINE’

foldable_robotics.dxf.list_attrib(filename, attrib)[source]

list the attributes of all the items in the dxf. use a string like ‘color’ or ‘layer’

Parameters
  • filename (string) – path to the dxf.

  • attrib (string) – attribute you wish to search.

foldable_robotics.dxf.read_circles(filename, color=None, layer=None)[source]

Reads a dxf file searching for circle objects, approximating arc elements in an lwpolyline with an n-segement set of lines

Parameters
  • filename (string) – the file path of the source dxf

  • color – optional. if included, this function filters for objects of only this color

  • layer – optional. if included, this function filters for objects of only this layer

Return type

List of tuples consisting (center and radius) representing each circle.

foldable_robotics.dxf.read_lines(filename, color=None, layer=None)[source]

Reads a dxf file searching for line objects,

Parameters
  • filename (string) – the file path of the source dxf

  • color – optional. if included, this function filters for objects of only this color

  • layer – optional. if included, this function filters for objects of only this layer

Return type

List of lines consisting of two two-coordinate tuples each.

foldable_robotics.dxf.read_lwpolylines(filename, color=None, layer=None, arc_approx=0)[source]

Reads a dxf file searching for lwpolyline objects, approximating arc elements in an lwpolyline with an n-segement set of lines

Parameters
  • filename (string) – the file path of the source dxf

  • color – optional. if included, this function filters for objects of only this color

  • layer – optional. if included, this function filters for objects of only this layer

  • arc_approx (int) – number of interior points to approximate an arc with

Return type

List of lines consisting of two two-coordinate tuples each.

foldable_robotics.dxf.read_text(filename, color=None, layer=None)[source]

Reads a dxf file searching for text objects,

Parameters
  • filename (string) – the file path of the source dxf

  • color – optional. if included, this function filters for objects of only this color

  • layer – optional. if included, this function filters for objects of only this layer

Return type

List of tuples consisting ((x,y),text,height, and rotation) representing each text element.

foldable_robotics.dynamics_info module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

class foldable_robotics.dynamics_info.DynamicsInfo(connected_items, connections, newtonian_ids, material_properties)[source]

Bases: object

catchall container for holding information about rigid bodies and their connections

class foldable_robotics.dynamics_info.JointProps(stiffness, damping, preload, limit_neg, limit_pos, z_pos)[source]

Bases: object

The JointProps class holds all the information about each joint’s dynamic properties.

class foldable_robotics.dynamics_info.MaterialProperty(name, color, thickness, E1, E2, density, poisson, is_adhesive, is_rigid, is_conductive, is_flexible)[source]

Bases: object

The MaterialProperty class holds all the information about each layer’s material information. The geometry and material prop information can be passed seaprately, permitting more complex representations.

copy()[source]

Copies the class

Return type

MaterialProperty

classmethod make_n_blank(n, thickness=1, E1=1, E2=1, density=1, poisson=1, is_adhesive=False, is_rigid=False, is_conductive=False, is_flexible=False)[source]

Creates several instances with slightly different colors for differentiation

Parameters
  • n (int) – number of instances

  • thickness (float) – the thickness of the layer

  • E1 (float) – Young’s modulus along the primary direction

  • E2 (float) – Young’s modulus along the secondary direction

  • density (float) – density of the material

  • poisson (float) – poisson’s ratio of the material

  • is_adhesive (bool) – indicates whether the material is an adhesive

  • is_rigid (bool) – indicates whether the material is rigid

  • is_conductive (bool) – indicates whether the material is conductive

  • is_flexible (bool) – indicates whether the material is flexible

Return type

MaterialProperty

foldable_robotics.general module

Created on Tue Oct 2 14:39:00 2018

@author: daukes

foldable_robotics.general.rectangular_array(shape, spacing_x, spacing_y, num_x, num_y)[source]

foldable_robotics.geometry module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

foldable_robotics.geometry.close_to(a, b, tolerance=1e-05)[source]
foldable_robotics.geometry.colinear_segment_interior_points(segA, segB, tolerance=1e-05)[source]

requires that you check slope and intercept first

(pA1,pA2)TYPE

DESCRIPTION.

(pB1,pB2)TYPE

DESCRIPTION.

interiorTYPE

DESCRIPTION.

foldable_robotics.geometry.distance(p1, p2)[source]
foldable_robotics.geometry.heal_polylines(lines, tolerance=0.001)[source]
foldable_robotics.geometry.inner_angle(v1, v2)[source]

finds the interior angle between two vectors

Parameters
  • v1 (tuple or list of floats) – the first vector

  • v2 (tuple or list of floats) – the second vector

Return type

float

foldable_robotics.geometry.interior(seg, p)[source]
foldable_robotics.geometry.length(v1)[source]

finds the length of a vector

Parameters

v1 (tuple or list of floats) – the vector

Return type

float

foldable_robotics.geometry.slope_intercept(p1, p2)[source]
foldable_robotics.geometry.total_angle(v1, v2, v3=None)[source]

finds the interior angle between two vectors

Parameters
  • v1 (tuple or list of floats) – the first vector

  • v2 (tuple or list of floats) – the second vector

Return type

float

foldable_robotics.gmsh_support module

Created on Thu Feb 14 15:03:43 2019

@author: danaukes

class foldable_robotics.gmsh_support.Coherence(l1_volumes, l2_volumes)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

string()[source]
class foldable_robotics.gmsh_support.Extrude(surface, t)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

extruded_points()[source]
string()[source]
class foldable_robotics.gmsh_support.GeoFile(characteristic_len_min=None, characteristic_len_max=None)[source]

Bases: object

make_mesh(delete_files=True)[source]
point_tuples()[source]
string()[source]
template = '\n    SetFactory("OpenCASCADE");\n    Geometry.LineNumbers = 0;\n    Geometry.SurfaceNumbers = 0;\n'
class foldable_robotics.gmsh_support.GmshObject[source]

Bases: object

assign_id()[source]
ii = 0
class foldable_robotics.gmsh_support.Line(p1, p2)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

string()[source]
class foldable_robotics.gmsh_support.Loop(*lines)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

string()[source]
class foldable_robotics.gmsh_support.Point(x, y, z, p)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

comp()[source]
string()[source]
class foldable_robotics.gmsh_support.Surface(loop)[source]

Bases: foldable_robotics.gmsh_support.GmshObject

string()[source]
foldable_robotics.gmsh_support.laminate_to_geo(lam, layer_thickness, characteristic_len_min=None, characteristic_len_max=None)[source]

foldable_robotics.jupyter_support module

Created on Fri Dec 29 13:06:11 2017

@author: danaukes

foldable_robotics.jupyter_support.color_tuple_to_hex(tuple_in)[source]

foldable_robotics.laminate module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

class foldable_robotics.laminate.Laminate(*layers)[source]

Bases: idealab_tools.iterable.Iterable, foldable_robotics.class_algebra.ClassAlgebra

The Laminate class holds a list of layers and can be operated upon with CSG-style functions.

affine_transform(*args, **kwargs)[source]

affine transform the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

binary_operation(function_name, other, *args, **kwargs)[source]

performs a binary operation between self and other.

Parameters
  • function_name (string) – the layer-based function to be performed

  • other (Laminate) – the layer-based function to be performed

  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

bounding_box()[source]

create a bounding box of the layer and return as a layer

bounding_box_coords()[source]

compute the lower left hand and upper right coordinates for computing a bounding box of the layer

buffer(*args, **kwargs)[source]

dilate or erode the laminate based on the arguments sent. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

copy(identical=True)[source]

creates a copy of the instance

Parameters

identical (boolean) – whether to use the same id or not.

Return type

Laminate

create_material_properties()[source]
difference(other)[source]

takes the difference of self - other.

:param other:the other laminate :type other: Laminate :rtype: Laminate

dilate(*args, **kwargs)[source]

dilate the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

erode(*args, **kwargs)[source]

erode the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

export_dict()[source]

converts the laminate to a dict.

Return type

dict

export_dxf(name)[source]

export the laminate to a .dxf file see the corresponding layer function for arguments and keyword-arguments

Parameters

name (string) – filename to export

gen_colors(alpha=None)[source]
get_dimensions()[source]
classmethod import_dict(d)[source]

converts a dict to a Laminate class

Parameters

d (dict) – the laminate in dict form

Return type

Laminate

intersection(other)[source]

takes the intersection of self and other.

Parameters

other (Laminate) – the other laminate

Return type

Laminate

is_null()[source]
property list

converts the laminate to a list.

map_line_place(*args, **kwargs)[source]

transform the laminate based on two lines. see foldable_robotics.manufacturing.map_line_stretch for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

map_line_scale(*args, **kwargs)[source]

transform the laminate based on two lines. see foldable_robotics.manufacturing.map_line_stretch for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

map_line_stretch(*args, **kwargs)[source]

transform the laminate based on two lines. see foldable_robotics.manufacturing.map_line_stretch for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

mass_properties(material_properties)[source]

calculate mass properties

Parameters

material_properties (foldable_robotics.dynamics_info.MaterialProperty) – tuple of arguments passed to subfunction

Return type

tuple of mass properties

mesh_items(material_properties)[source]

create a mesh for 3d rendering using pyqtgraph

Parameters

material_properties (foldable_robotics.dynamics_info.MaterialProperty) – tuple of arguments passed to subfunction

Return type

GLMeshItem

plot(new=False)[source]

plots the laminate using matplotlib.

Parameters

new (boolean) – whether to create a new figure

plot_3d(material_properties=None)[source]
plot_layers()[source]

plots each layer of the laminate in a new figure using matplotlib.

rotate(*args, **kwargs)[source]

rotate the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

scale(*args, **kwargs)[source]

scale the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

simplify(*args, **kwargs)[source]

simplify the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

svg(scale_factor=1.0)[source]

returns the svg

symmetric_difference(other)[source]

takes the symmetric difference of self and other.

Parameters

other (Laminate) – the other laminate

Return type

Laminate

to_mesh(layer_thickness, characteristic_len_min=None, characteristic_len_max=None)[source]

create a mesh object with gmsh

translate(*args, **kwargs)[source]

translate the laminate. see the corresponding layer function for arguments and keyword-arguments

Parameters
  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

unary_operation(function_name, *args, **kwargs)[source]

performs a unary operation on the laminate.

Parameters
  • function_name (string) – the layer-based function to be performed

  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Laminate

unary_union(*others)[source]
union(other)[source]

unions two laminates together.

Parameters

other (Laminate) – the other laminate

Return type

Laminate

exception foldable_robotics.laminate.WrongNumLayers[source]

Bases: Exception

Custom exception for when two laminates of the wrong number of layers interact.

foldable_robotics.layer module

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

class foldable_robotics.layer.Layer(*geoms)[source]

Bases: foldable_robotics.class_algebra.ClassAlgebra

The Layer class is essentially a list of 2d polygons which all exist on the same plane.

affine_transform(*args, **kwargs)[source]
binary_operation(other, function_name, *args, **kwargs)[source]

performs a binary operation between self and other.

Parameters
  • function_name (string) – the layer-based function to be performed

  • other (Layer) – the layer-based function to be performed

  • args (tuple) – tuple of arguments passed to subfunction

  • kwargs (dict) – keyword arguments passed to subfunction

Return type

Layer

bounding_box()[source]

create a bounding box of the layer and return as a layer

bounding_box_coords()[source]

compute the lower left hand and upper right coordinates for computing a bounding box of the layer

buffer(value, resolution=None)[source]

dilate (or erode) the geometries in the layer

Parameters
  • value (float) – the positive (or negative) radius of the dilation (or erosion)

  • resolution (int) – the number of interpolanting vertices to use

Return type

Layer

contains(*args)[source]
copy(identical=True)[source]

creates a copy of the instance

Parameters

identical (boolean) – whether to use the same id or not.

Return type

Layer

create_material_property(color=None)[source]
difference(other)[source]

returns the difference between self and other.

Parameters

other (Layer) – the other layer

Return type

Layer

dilate(value, resolution=None)[source]

dilate the geometries in the layer

Parameters
  • value (float) – the radius of the dilation

  • resolution (int) – the number of interpolanting vertices to use

Return type

Layer

erode(value, resolution=None)[source]

erode the geometries in the layer

Parameters
  • value (float) – the radius of the erotion

  • resolution (int) – the number of interpolanting vertices to use

Return type

Layer

export_dict()[source]

converts the layer to a dict.

Return type

dict

export_dxf(name)[source]

export the layer to a dxf

Parameters

name (string) – the filename to write

exteriors()[source]

return the clockwise exterior coordinates of all closed shapes in the layer

extrude(z_lower, material_property)[source]

create tetrahedra from the layer and return as a set of points and tetrahedra indeces

get_dimensions()[source]
get_paths()[source]

get the inner and outer paths of a layer’s geometry

Parameters

self (foldable_robotics.layer.Layer) – the geometry

Return type

list of list of coordinate tuples

get_segments()[source]

get the line segments of a layer or linestring

Parameters

poly (shapely.geometry.Polygon or shapely.geometry.LineString) – the geometry

Return type

list of two-coordinate segments

classmethod import_dict(d)[source]

converts a dict to a Layer instance

Parameters

d (dict) – the laminate in dict form

Return type

Laminate

inertia(about_point, z_lower, material_property)[source]

compute the inertia tensor for the layer

interiors()[source]

return the interior coordinates of all shapes in the layer

intersection(other)[source]

returns the intersection between self and other.

Parameters

other (Layer) – the other layer

Return type

Layer

is_null()[source]
classmethod make_text(text, *args, **kwargs)[source]

makes a layer of text

map_line_stretch(p1, p2, p3, p4)[source]

Transforms a layer or laminate by using the translation and rotation between two lines to compute the stretch, scale, and rotation.

Parameters
  • self (Layer or Laminate) – input shape

  • p1 (tuple) – point 1 of line 1 in (x,y) format

  • p1 – point 2 of line 1 in (x,y) format

  • p1 – point 1 of line 2 in (x,y) format

  • p1 – point 2 of line 2 in (x,y) format

Return type

Layer

mass_props(material_property, bottom, top)[source]

compute the mass properties of the layer

mesh_items(z_offset=0, color=(1, 0, 0, 1))[source]

Return a pyqtgraph.opengl.GLMeshItem for the layer

mesh_items_inner(z_offset=0, color=(1, 0, 0, 1))[source]

inner loop for meshing the layer

classmethod new(*geoms)[source]

create a new class instance

Parameters

geoms (list of shapely.geometry classes) – a list of shapely geometries contained by the layer

Return type

Layer

plot(*args, **kwargs)[source]

plots the layer using matplotlib.

Parameters

new (boolean) – whether to create a new figure

rotate(angle, origin=(0, 0), use_radians=False)[source]

rotate the layer

Parameters
  • angle (float) – the amount of rotation

  • origin (string or tuple) – the origin to use in calculating the rotation

  • use_radians (boolean) – whether to use radians or degrees

Return type

Layer

scale(xfact=1.0, yfact=1.0, zfact=1.0, origin=(0, 0))[source]

scale the layer

Parameters
  • xfact (float) – the amount of x scaling

  • yfact (float) – the amount of y scaling

  • zfact (float) – the amount of z scaling

Return type

Layer

simplify(tolerance)[source]

simplify the layer by reducing the number of coordinates. uses shapely’s simplify function.

Parameters

tolerance (float) – the length scale by which to simplify

Return type

Layer

svg(scale_factor=1.0)[source]

returns the svg

symmetric_difference(other)[source]

returns the symmetric difference between self and other.

Parameters

other (Layer) – the other layer

Return type

Layer

to_laminate(value)[source]

convert a layer to a laminate of “value” layers

Parameters
  • self (integer) – the layer itself

  • value – the number of layers in the laminate

Rtype self

a layer

translate(xoff=0.0, yoff=0.0, zoff=0.0)[source]

translate the layer

Parameters
  • xoff (float) – the amount of x translation

  • yoff (float) – the amount of y translation

  • zoff (float) – the amount of z translation

Return type

Layer

triangulation()[source]

triangulate a layer

Return type

array of points, array of triangle indeces

unary_union(*others)[source]
union(other)[source]

returns the union between self and other.

Parameters

other (Layer) – the other layer

Return type

Layer

exception foldable_robotics.layer.NoGeoms[source]

Bases: Exception

foldable_robotics.layer.check_loop(loop)[source]

remove the last element of loop if it is the same as the first

Parameters

loop (iterable of tuples) – list of coordinates

Return type

iterable of tuples

foldable_robotics.layer.extract_r(item, list_in=None)[source]

recursively extracts geometries from collections of geometries

Parameters
  • item (class from shapely.geometry) – the shapely geometry

  • list_in (list) – a list to add to

Return type

boolean

foldable_robotics.layer.extrude(points, tris, z_lower, z_upper)[source]

create 3d tetrahedra from 2d triangles

Parameters
  • points (numpy.array) – array of 3d points

  • tris (numpy.array) – the triangle coordinates

  • z_lower (float) – the lower z value

  • z_upper (float) – the upper z value

Return type

list of Tetrahedron

foldable_robotics.layer.flatten(geoms)[source]

eliminate any collections of geometries by flattening all into a single list.

Parameters

geoms (list or iterable) – the shapely geometries

Return type

list

foldable_robotics.layer.from_layer_to_shapely(layer)[source]

convert from Layer class to shapely geometry

Parameters

layer (Layer) – the layer instance

Return type

class from shapely.geometry

foldable_robotics.layer.from_shapely_to_layer(new_geoms)[source]

convert from shapely geometry to Layer class

Parameters

new_geoms (list or iterable) – the shapely geometries

Return type

Layer

foldable_robotics.layer.inertia_tensor(about_point, density, z_lower, z_upper, points, tris)[source]

create 3d inertia tensor from a 2d list of triangles

Parameters
  • about_point (3d coordinate) – the point about which to compute the inertia

  • density (float) – the density of the material

  • z_lower (float) – the lower z value

  • z_upper (float) – the upper z value

  • points (numpy.array) – array of 3d points

  • tris (numpy.array) – the triangle coordinates

Return type

list of Tetrahedron

foldable_robotics.layer.is_collection(item)[source]

determines whether the geometry defined by item contains multiple geometries

Parameters

item (class from shapely.geometry) – the shapely geometry

Return type

boolean

foldable_robotics.layer.layer_constructor(loader, node)[source]

function for constructing layer from a dictionary for use by yaml

foldable_robotics.layer.layer_representer(dumper, v)[source]

function for representing layer as a dictionary for use by yaml

foldable_robotics.layer.plot_poly(poly, color=None, edgecolor=None, facecolor=None, linewidth=0.25)[source]

plot a shapely geometry

Parameters
  • poly (class from shapely.geometry) – the layer instance

  • edgecolor (tuple) – tuple of r,g,b,a scalars from 0 to 1

  • facecolor (tuple) – tuple of r,g,b,a scalars from 0 to 1

  • linewidth (scalar or None for default) – width of the line

foldable_robotics.layer.points_2d_to_3d(points_2d, z_val)[source]

convert a list of 2d points to a list of 3d points

Parameters
  • points_2d (numpy.array) – the geometry to triangulate

  • z_val (float) – the padded z value

Return type

numpy.array

foldable_robotics.layer.triangulate_geom(geom)[source]

triangulate a shapely geometry

Parameters

geom (shapely.Polygon) – the geometry to triangulate

Return type

array of points, array of triangle indeces

foldable_robotics.manufacturing module

A collection of tools used to compute manufacturing geometry useful for laminates and layers.

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.

foldable_robotics.manufacturing.bounding_box(laminate)[source]

This function computes a bounding box aligned with the x and y axes for the given laminate.

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.calc_hole(hinge_lines, width, resolution=None)[source]

From a list of lines computes the hole needed at a node, based on hinge gaps.

Parameters
  • hinge_lines (list of tuples) – input shape

  • width (float) – width of the hinge

Return type

Laminate

foldable_robotics.manufacturing.calc_projection_down(laminate)[source]

find the projection of the laminate up

foldable_robotics.manufacturing.calc_projection_up(laminate)[source]

find the projection of the laminate up

foldable_robotics.manufacturing.cleanup(input1, value, resolution=None)[source]

Cleans up the layer or laminate by using successive dilate and erode functions to remove small objects. Results in rounded edges

Parameters
  • input1 (Layer or Laminate) – input shape

  • value (float) – dilate / erode radius

  • resolution (float) – resolution

Return type

Layer or Laminate

foldable_robotics.manufacturing.cleanup2(a, radius, resolution=None)[source]

Cleans up the layer or laminate by using successive dilate and erode functions to remove small objects. Attempts to address rounded corners with additional CSG logic, at the cost of computation and non-intuitive results.

Parameters
  • a (Layer or Laminate) – input shape

  • radius (float) – dilate / erode radius

  • resolution (float) – resolution

Return type

Layer or Laminate

foldable_robotics.manufacturing.find_connected(laminate, adhesive)[source]

Creates a list of laminates which are topologically connected above or below and across multiple layers.

Parameters
  • laminate (Laminate) – input shape

  • adhesive (list of booleans) – indicates whether each layer sticks to its neighbors.

Return type

Laminate

foldable_robotics.manufacturing.keepout_laser(laminate)[source]

This function computes the keepout laminate for a laser cut operation..

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.keepout_mill_down(laminate)[source]

This function computes the keepout laminate for a milling operation with the mill below the bottom layer.

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.keepout_mill_flip(laminate)[source]

This function computes the keepout laminate for a milling operation with the mill cutting from above and below.

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.keepout_mill_up(laminate)[source]

This function computes the keepout laminate for a milling operation with the mill above the top layer.

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.lines_to_shapely(hinge_lines)[source]

From a list of two-coordinate tuples, creates shapely lines.

Parameters

hinge_lines (list of tuples) – input shape

Return type

Laminate

foldable_robotics.manufacturing.map_line_place(self, p1, p2, p3, p4)[source]

Transforms a layer or laminate by using the translation and rotation between two lines to compute the stretch, scale, and rotation.

Parameters
  • self (Layer or Laminate) – input shape

  • p1 (tuple) – point 1 of line 1 in (x,y) format

  • p1 – point 2 of line 1 in (x,y) format

  • p1 – point 1 of line 2 in (x,y) format

  • p1 – point 2 of line 2 in (x,y) format

  • kwargs (dict) – unused

Return type

Layer or Laminate

foldable_robotics.manufacturing.map_line_scale(self, p1, p2, p3, p4)[source]

Transforms a layer or laminate by using the translation and rotation between two lines to compute the stretch, scale, and rotation.

Parameters
  • self (Layer or Laminate) – input shape

  • p1 (tuple) – point 1 of line 1 in (x,y) format

  • p1 – point 2 of line 1 in (x,y) format

  • p1 – point 1 of line 2 in (x,y) format

  • p1 – point 2 of line 2 in (x,y) format

  • kwargs (dict) – unused

Return type

Layer or Laminate

foldable_robotics.manufacturing.map_line_stretch(self, p1, p2, p3, p4)[source]

Transforms a layer or laminate by using the translation and rotation between two lines to compute the stretch, scale, and rotation.

Parameters
  • self (Layer or Laminate) – input shape

  • p1 (tuple) – point 1 of line 1 in (x,y) format

  • p1 – point 2 of line 1 in (x,y) format

  • p1 – point 1 of line 2 in (x,y) format

  • p1 – point 2 of line 2 in (x,y) format

  • kwargs (dict) – unused

Return type

Layer or Laminate

foldable_robotics.manufacturing.modify_device(device, custom_support_line, support_width, support_gap, hole_buffer)[source]

From a list of two-coordinate tuples, creates shapely lines.

Parameters
  • device (Laminate) – input shape

  • custom_support_line (Laminate) – desired additional support geometry

  • support_width (float) – width of desired support

  • support_gap (float) – gap between device and support

  • hole_buffer (float) – gap between user-supplied support and computed support hole

Return type

Laminate

foldable_robotics.manufacturing.modify_keepout(laminate, is_adhesive)[source]

is this better than other algorithms

foldable_robotics.manufacturing.modify_up(laminate, is_adhesive)[source]
foldable_robotics.manufacturing.not_removable_both(laminate)[source]

This function computes the non-removable material in the either direction for a given laminate.

Parameters

laminate (Laminate) – input shape

Return type

Laminate

foldable_robotics.manufacturing.not_removable_down(laminate, is_adhesive)[source]

This function computes the non-removable material in the down direction for a given laminate.

Parameters
  • laminate (Laminate) – input shape

  • is_adhesive (list) – list of booleans indicating whether the layer at that index is an adhesive layer.

Return type

Laminate

foldable_robotics.manufacturing.not_removable_up(laminate, is_adhesive)[source]

This function computes the non-removable material in the up direction for a given laminate.

Parameters
  • laminate (Laminate) – input shape

  • is_adhesive (list) – list of booleans indicating whether the layer at that index is an adhesive layer.

Return type

Laminate

foldable_robotics.manufacturing.split_laminate_by_geoms(laminate)[source]

This function splits a laminate into n respective geometries and returns one laminate for each geom.

Parameters

laminate (Laminate) – input shape

Return type

list of Laminates

foldable_robotics.manufacturing.support(laminate, keepout_method, width, invalid_width, small_dim=0.001)[source]

This function computes support for a laminate.

Parameters
  • laminate (Laminate) – input shape

  • keepout_method (python function ref) – the keepout method selected for the computation

  • width (float) – gap away from the original laminate

  • invalid_width (float) – value to keep support away from non-cuttable regions.

  • small_dim (float) – relatively small dimension for eliminating numerical precision problems.

Return type

Laminate

foldable_robotics.manufacturing.unary_union(laminate)[source]

Unions all the layers in a laminate together and returns to a new Layer.

Parameters

laminate (Laminate) – input shape

Return type

Layer

foldable_robotics.manufacturing.zero_test(laminate)[source]

This function checks whether a laminate is empty.

Parameters

laminate (Laminate) – input shape

Return type

boolean

foldable_robotics.parts-old module

foldable_robotics.pdf module

Created on Wed Feb 7 20:34:27 2018

@author: danaukes

class foldable_robotics.pdf.Page(filename='output.pdf', width=40, height=28)[source]

Bases: object

This class defines a pdf page, which can hold vector geometry.

close()[source]

close the surface

Return type

None

draw_linestring(geom, line_color=(0, 0, 0, 1), line_width=0.01, fill_color=(0, 0, 0, 1))[source]

Draw an open linestring.

Parameters
  • poly (list of tuples) – describes each vertex of the linestring.

  • line_color (tuple of floats) – line color in (r,g,b,a) format.

  • line_width (tuple of floats) – width of the line

  • fill_color – color of the linestring interior, in (r,g,b,a) format

Return type

None

draw_poly(poly, line_color=(0, 0, 0, 1), line_width=0.01, fill_color=(0, 0, 0, 1))[source]

Draw a closed polygon.

Parameters
  • poly (list of tuples) – describes each vertex of the polygon.

  • line_color (tuple of floats) – line color in (r,g,b,a) format.

  • line_width (tuple of floats) – width of the line

  • fill_color – color of the polygon interior, in (r,g,b,a) format

Return type

None

foldable_robotics.plotter_support module

Created on Wed Feb 7 20:34:27 2018

@author: danaukes

class foldable_robotics.plotter_support.Plotter[source]

Bases: object

foldable_robotics.plotter_support.layer_string(layer)[source]
foldable_robotics.plotter_support.path_string(path)[source]

foldable_robotics.solidworks_support module

Created on Thu Jan 3 14:23:36 2019

@author: daukes

class foldable_robotics.solidworks_support.Component[source]

Bases: object

class foldable_robotics.solidworks_support.Face[source]

Bases: object

foldable_robotics.solidworks_support.component_to_layer(component)[source]
foldable_robotics.solidworks_support.create_layered_dxf(elements, filename)[source]
foldable_robotics.solidworks_support.create_loops(filename, prescale)[source]
foldable_robotics.solidworks_support.get_joints(*layers, tolerance=1e-05)[source]
foldable_robotics.solidworks_support.length(segment)[source]
class foldable_robotics.solidworks_support.obj[source]

Bases: object

foldable_robotics.solidworks_support.objectify(var)[source]
foldable_robotics.solidworks_support.process(input_filename, output_file_name, prescale, round_digits, body_prebuffer=- 0.001, joint_tolerance=1e-05)[source]

Module contents

The foldable_robotics package is useful for designing and computing layer-based geometries for cutting out robots from sheet-based materials using a laser or other CNC tool. This collection of modules makes it easy to create foldable robotic devices and to automate the calculation of the manufacturing files.

Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license.