From fc3f1a23b87d9c4e51967abb0ed4107daa2be5cf Mon Sep 17 00:00:00 2001 From: Hiroshi Murayama Date: Sat, 28 Sep 2019 17:40:09 +0900 Subject: improve DXF file handling functions: - DM_LINE mode support to generate Excellon routing sequence - DM_MOUSE_BITES mode support to generate mouse bites along all path also, not only line object --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8deccd0..6f84cb7 100644 --- a/README.md +++ b/README.md @@ -70,19 +70,21 @@ ctx.dump('panelized-board.txt') ## DXF file translation ### PCB Outline -You can also load a dxf file and handle that as same as RX-274x gerber file.
+You can also load a dxf file and handle that as same as RX-274x gerber file or Excellon NC file.
This function is useful to generate outline data of pnanelized PCB boad. ```python import gerberex -ctx = gerberex.GerberComposition() dxf = gerberex.read('outline.dxf') -ctx.merge(dxf) +ctx1 = gerberex.GerberComposition() +ctx1.merge(dxf) +ctx2 = gerberex.DrillComposition() +ctx2.merge(dxf) ``` Circle object, Arc object, Line object and Polyline object are supported. Other kind of objects in DXF file are ignored when translating to gerber data. -You can specify line width (default 0). PCB tools extension will translate DXF primitive shape to RX-274x line or arc sequense using circle aperture with diamater as same as specified line width.
+You can specify line width (default 0). PCB tools extension will translate DXF primitive shape to RX-274x line or arc sequense using circle aperture with diamater as same as specified line width.
```python import gerberex @@ -93,6 +95,19 @@ dxf.width = 0.004 dxf.write('outline.gml') ``` +If ```FT_EXCELLON``` is specified for ```filetype``` argument of ```write()```, Excellon NC data is generated. In this case, Excellon file consists of routing commands using a specified width drill. + + +```python +import gerberex + +dxf = gerberex.read('outline.dxf') +dxf.to_metric() +dxf.width = 0.3 +dxf.write('outline.txt', filetype=dxf.FT_EXCELLON) +``` + + You can also translate DXF closed shape such as circle to RX-274x polygon fill sequence.
In order to fill closed shape, ```DM_FILL``` has to be set to ```draw_mode``` property. In this mode, All object except closed shapes listed below are ignored. @@ -100,6 +115,8 @@ In order to fill closed shape, ```DM_FILL``` has to be set to ```draw_mode``` pr - closed polyline - closed path which consists of lines and arcs +NOTE: ```DM_FILL``` can be used only to generate RX-274x data, it cannot be used to generate Excellon data. + ```python import gerberex @@ -122,7 +139,7 @@ outline.write('outline.gml') mouse bites -If ```DM_MOUSE_BITES``` is specified for ```draw_mode```, filled circles are arranged along a DXF line object at equal intervals.
+If ```DM_MOUSE_BITES``` is specified for ```draw_mode```, filled circles are arranged at equal intervals along a paths consisted of DXF line, arc, circle, and plyline objects.
DXF file object in this state can be merged to excellon file also. That means you can arrange mouse bites easily. ```python -- cgit