excellon — Excellon file handling

The Excellon format is the most common format for exporting PCB drill information. The Excellon format is used to program CNC drilling macines for drilling holes in PCBs. As such, excellon files are sometimes refererred to as NC-drill files. The Excellon format reference is available here. The excellon submodule implements calsses to read and write excellon files without having to know the precise details of the format.

The excellon submodule’s read() function serves as a simple interface for parsing excellon files. The ExcellonFile class stores all the information contained in an Excellon file allowing the file to be analyzed, modified, and updated. The ExcellonParser class is used in the background for parsing RS-274X files.

Functions

The excellon module defines the following functions:

read(filename)

Read data from filename and return an ExcellonFile Parameters

filename : string
Filename of file to parse
Returns:

file : gerber.excellon.ExcellonFile

An ExcellonFile created from the specified file.

Classes

The excellon module defines the following classes:

class ExcellonFile(statements, tools, hits, settings, filename=None)

A class representing a single excellon file

The ExcellonFile class represents a single excellon file.

http://www.excellon.com/manuals/program.htm (archived version at https://web.archive.org/web/20150920001043/http://www.excellon.com/manuals/program.htm)

Parameters:

tools : list

list of gerber file statements

hits : list of tuples

list of drill hits as (<Tool>, (x, y))

settings : dict

Dictionary of gerber file settings

filename : string

Filename of the source gerber file

Attributes

units (string) either ‘inch’ or ‘metric’.

Methods

hit_count
offset
path_length
render
report
to_inch
to_metric
update_tool
write
path_length(tool_number=None)

Return the path length for a given tool

primitives

Gets the primitives. Note that unlike Gerber, this generates new objects

report(filename=None)

Print or save drill report

to_inch()

Convert units to inches

to_metric()

Convert units to metric

update_tool(tool_number, **kwargs)

Change parameters of a tool

class ExcellonParser(settings=None, ext_tools=None)

Excellon File Parser

Parameters:

settings : FileSettings or dict-like

Excellon file settings to use when interpreting the excellon file.

Attributes

bounds
coordinates
hole_count
hole_sizes

Methods

parse
parse_raw