Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dxf2drill

Extract circles from a DXF file to an XNC drill file used for PCB fabrication.

Installation

The simplest to install is with uv:

$> uv tool install 'git+https://github.com/createk-sherbrooke/dxf2drill'

Usage

usage: dxf2drill [-h] [-e FILTER_EXPRESSION] filename

Extract circles from DXF file to XNC drill file

positional arguments:
  filename              Input DXF file

options:
  -h, --help            show this help message and exit
  -e FILTER_EXPRESSION, --filter-expression FILTER_EXPRESSION
                        Filter expression used to select circles converted to drill hits

Note: output is written to stdout

For more information on FILTER_EXPRESSION, see the ezdxf documentation on queries. dxf2drill passes FILTER_EXPRESSION to ezdxf like this to find circles:

circles = msp.query(f'CIRCLE[{filter_expression}]')

For example, to extract only holes smaller than 10 units of diameter (radius 5 units, DXF is unitless) on layer "0":

$> dxf2drill -e 'radius < 5 & layer == "0"' example.dxf > example.xnc

dxfstrip tool

This repository also includes the dxfstrip tool, which is installed alongside dxf2drill. It is a simple script that uses ezdxf to delete selected entities from a DXF file, and outputs the resulting "stripped" DXF to stdout.

This can be useful to remove all CIRCLEs which were exported to XNC:

$> dxfstrip 'CIRCLE[radius < 5]' example.dxf > example_no_holes.dxf

Another example, to remove all text (DXF MTEXT entities) on layer "0":

$> dxfstrip 'MTEXT[layer == 0]' example.dxf > example_no_text.dxf

About

Extract circles from DXF file to a XNC drill file used for PCB fabrication

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages