Chiplotle Tools

HPGL Tools

chiplotle.tools.hpgltools.find_hpgl_dimensions(hpgl)
returns [[minX, minY], [maxX, maxY]] found in hpgl object
chiplotle.tools.hpgltools.is_primitive_absolute(command)
Returns True of command is a primitive HPGL with absolute position, False if command is a non-absolute position primitive HPGL. Otherwise the function raises a TypeError exception.
chiplotle.tools.hpgltools.relativize(data)
Converts all absolute coordinate commands (PA, RA, EA, AA) into relative commands (PR, RR, ER, AR), so that everything has in realtive coordinate values.
chiplotle.tools.hpgltools.scale(obj, val)
chiplotle.tools.hpgltools.transpose(arg, val)

Input-output tools

chiplotle.tools.io.export(expr, filename, format='eps')

Export Chiplotle-HPGL objects to an image file format via hp2xx.

  • expr can be an iterable (e.g., list) of Chiplotle-HPGL objects or a

    single Chiplotle-HPGL object.

  • filename the file name, including path but without extension.

  • format is a string describing the format of the file to which the

    Chiplotle-HPGL objects will be exported. Default is ‘eps’. Valid formats are: cad, dxf, em, epic, eps, esc2, fig, gpt, hpgl, img, jpg, mf, nc, pbm, pcl, pcx, png, pre, rgip, svg, tiff.

Note

You must have hp2xx installed before you can export Chiplote-HPGL objects to image files.

chiplotle.tools.io.import_hpgl_file(filename)

Reads a text HPGL file and “inflates” it by creating Chiplotle-HPGL class instances of the found HPGL commands.

Example:

chiplotle> square = import_hpgl_file('examples/square.hpgl')
chiplotle> square
[SP(pen=1), PU(xy=[ 100.  100.]), PD(xy=[ 200.  100.]), 
PD(xy=[ 200.  200.]), PD(xy=[ 100.  200.]), 
PD(xy=[ 100.  100.]), SP(pen=0)]
chiplotle.tools.io.save_hpgl(expr, filename)

Save text HPGL from Chiplotle-HPGL.

  • expr can be an iterable (e.g., list) or a Chiplotle-HPGL object.
  • filename the file name, including path and extension (usually .hpgl or .plt)
chiplotle.tools.io.view(expr, format='eps')

Displays Chiplotle-HPGL objects for prevewing.

  • expr can be an iterable (e.g., list) or a Chiplotle-HPGL object.

  • format is the file format to which the given expr will be

    converted for viewing. The default is ‘eps’.

Math tools

chiplotle.tools.mathtools.bezier_interpolation(control_points, points_to_compute, weight)

Computes Bezier interpolations from given control_points. This uses the generalized formula for bezier curves: http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Generalization

  • control_points : A list of (x, y) control points.
  • points_to_compute: An int of the number of points to compute.
  • weight: A list of weights for control points.
chiplotle.tools.mathtools.catmull_interpolation(control_points, points_to_compute)
Computes Catmull-Rom interpolations from given control_points. first and last point are not on the curve, but define initial and final tangent - control_points : A list of (x, y) control points. - points_to_compute: An int of the number of points to compute.
chiplotle.tools.mathtools.pascal_row(n)
Returns the nth row of Pascal’s Triangle.
chiplotle.tools.mathtools.superformula(a, b, m, n1, n2, n3, phi)
Computes the position of the point on a superformula curve. Superformula has first been proposed by Johan Gielis and is a generalization of superellipse. see: http://en.wikipedia.org/wiki/Superformula

Table Of Contents

Previous topic

Chiplotle Known Plotters

Next topic

Hardware