3. dxf

Module for outputing from numpy/python to dxf file format, a vector graphics file format used for laser cutting and CAD applications – Dustin 2012ish

3.1. Overview

DXF() Class for handling dxf files using python.

3.2. Classes and Functions

class ilpm.dxf.DXF[source]

Class for handling dxf files using python. DXF is a vector graphics format widely used in CAD applications.

Methods

circle(X, r[, layer, preview_points]) Create a circle in the dxf instance
line(x0, y0, x1, y1[, layer]) Create a line segment in the dxf instance
plot_preview([show]) Plot the contents of the dxf instance
polyline(X[, layer, closed]) Create a sequence of line segments in the dxf instance
save(fn) Output the dxf instance to a dxf file
save(fn)[source]

Output the dxf instance to a dxf file

line(x0, y0, x1, y1, layer='0')[source]

Create a line segment in the dxf instance

Parameters:

x0 : float

starting x coordinate for lineseg

y0 : float

starting y coordinate for lineseg

x1 : float

ending x coordinate for lineseg

y1 : float

ending y coordinate for lineseg

layer : str (default=‘0’)

which layer of the dxf vector graphics image to add line to

polyline(X, layer='0', closed=False)[source]

Create a sequence of line segments in the dxf instance

Parameters:

X : length N list of length 2 lists of floats or N x 2 float array

the sequence of points for which to create linesegments, in order

layer : str (default=‘0’)

which layer of the dxf vector graphics image to add line to

closed : bool

whether to connect X[-1] to X[0] as a lineseg

circle(X, r, layer='0', preview_points=200)[source]

Create a circle in the dxf instance

Parameters:

X : length 2 list of floats or 2 x 1 float array

the center point for the circle to create

r : float

the radius of the circle

layer : str (default=‘0’)

which layer of the dxf vector graphics image to add line to

preview_points : int

how many points with which to approximate the circle in the preview (the actual dxf file has a true vector graphics circle)

plot_preview(show=True)[source]

Plot the contents of the dxf instance

Parameters:

show : bool

whether to render the figure showing the dxf contents