forked from mondalaci/dxf2svg2kicad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
182 lines (170 loc) · 9.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html>
<head>
<title>DXF to SVG to KICAD_PCB converter</title>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="kicad.png" />
<link href="//fonts.googleapis.com/css?family=Telex" rel="stylesheet">
<link href="components/html5-boilerplate/css/normalize.css" rel="stylesheet">
<link href="components/html5-boilerplate/css/main.css" rel="stylesheet">
<link href="index.css" rel="stylesheet">
</head>
<body>
<a href="https://github.com/mondalaci/dxf2svg2kicad">
<img id="ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
</a>
<h1>dxf2svg2kicad — DXF to SVG to KICAD_PCB converter</h1>
<section id="main">
<p class="upgrade-browser-notification">
This web application uses modern web technologies that do not seem to be supported by your browser.<br>
Please <a href="https://www.google.com/chrome/" target="_blank">use the latest version of Google Chrome</a> instead!
</p>
<p class="firefox-notification">
You seem to be using Firefox which is known to cause the exported DXF to contain inaccurate lines.<br>
Please <a href="https://www.google.com/chrome/" target="_blank">use Google Chrome</a> instead!
</p>
<ol class="main-list">
<li>Choose a DXF or SVG file to be converted —
<input id="input-file-chooser" type="file"><br>
<span id="invalid-extension" class="invalid-input">Invalid file chosen! —
Only files with DXF or SVG extensions are processed.<br></span>
(You can try <a href="tests/test.dxf">test.dxf</a> or
<a href="tests/test.svg">test.svg</a> for testing purposes.)</li>
<li>
Check the preview image.
<div id="segmentation-notification">
If the preview image or the exported file is incomplete, then
<ol id="dxf-segmentation-notification">
<li>Open it in a CAD application like <a href="http://qcad.org/" target="_blank">QCAD</a>.</li>
<li>Select the whole drawing.</li>
<li>Use the EXPLODE command.</li>
<li>Save it as a new DXF.</li>
</ol>
<ol id="svg-segmentation-notification">
<li>Open it in Inkscape.</li>
<li>
Set path string format to absolute:
<ul>
<li>For older versions of Inkscape, uncheck the "File -> Inkscape Preferences... ->
SVG output -> Path data -> Allow relative coordinates" checkbox.</li>
<li>For newer versions of Inkscape, set the "Edit -> Preferences... -> Input/Output ->
SVG output -> Path data -> Path string format" option to "Absolute".</li>
</ul>
</li>
<li>Select the "Edit paths by nodes" tool (F2).</li>
<li>Select the whole drawing (Ctrl+A).</li>
<li>Reselect the whole drawing, thereby highlighting the individual nodes (Ctrl+A).</li>
<li>In the node toolbar select "Break path at selected nodes" (Shift+B).</li>
<li>Use the "Path -> Break Apart" command (Shift+Ctrl+K).</li>
<li>Deselect, select and reselect nodes (Esc, Ctrl+A, Ctrl+A).</li>
<li>In the node toolbar select "Make selected segments lines" (Shift+L).</li>
<li>Set the stroke color to black so that you can see the final image
(Shift + Left-click on the black color of the palette).</li>
<li>Save the SVG as a new drawing.</li>
</ol>
Finally, open the newly saved file in dxf2svg2kicad and it should work.
</div>
<div id="svg-image-container"></div>
</li>
<li>
<span id="no-save-link" class="save-link">Save the converted SVG or KICAD_PCB file.</span>
<span id="kicad-pcb-save-link" class="save-link">Save the converted
<a class="save-kicad-pcb-link" href="#_">KICAD_PCB</a> file.</span>
<span id="svg-and-kicad-pcb-save-links" class="save-link">Save the converted
<a class="save-svg-link" href="#_">SVG</a> or
<a class="save-kicad-pcb-link" href="#_">KICAD_PCB</a> file.</span>
<br>
<span id="advanced-options-expander"><a id="advanced-options-link" href="#_">Advanced options...</a></span>
<div id="advanced-options">
<br>
Note that the following options only pertain to KICAD_PCBs, not SVGs.<br>
<ul>
<li>
Layer to be used is
<select id="layer">
<option value="F.Adhes">F.Adhes</option>
<option value="B.Adhes">B.Adhes</option>
<option value="F.Paste">F.Paste</option>
<option value="B.Paste">B.Paste</option>
<option value="F.SilkS">F.SilkS</option>
<option value="B.SilkS">B.SilkS</option>
<option value="F.Mask">F.Mask</option>
<option value="B.Mask">B.Mask</option>
<option value="Dwgs.User">Dwgs.User</option>
<option value="Cmts.User">Cmts.User</option>
<option value="Eco1.User">Eco1.User</option>
<option value="Eco2.User">Eco2.User</option>
<option value="Edge.Cuts" selected>Edge.Cuts</option>
<option value="Margin">Margin</option>
</select>
</li>
<li>
Translate drawing by
<input id="translation-x" type="number" step="any" value="0" class="float-input">X
<input id="translation-y" type="number" value="0" class="float-input">Y mm
<div id="invalid-input-translation-x" class="invalid-input">
Coordinate X is not a valid floating-point number! — Using 0 instead.</div>
<div id="invalid-input-translation-y" class="invalid-input">
Coordinate Y is not a valid floating-point number! — Using 0 instead.</div>
</li>
<li>
Append converted file to <input id="appended-file-chooser" type="file" accept=".kicad_pcb">
<div id="invalid-append-file" class="invalid-input">
The chosen file is not a valid KICAD_PCB file and won't be used!
</div>
</li>
</ul>
</div>
</li>
<li>
If this tool worked for you then please consider
<a id="donate-link" href="#_" target="_blank">buying me a beer</a> or
<a id="report-link" href="#report-help">report a bug</a> if it didn't work.
<div id="report-help">
<div class="upgrade-browser-notification">
Your browser does not support the following feature(s): <span id="missing-features"></span><br>
Please upgrade your browser as shown above and retry this web application before reporting a bug!
</div>
<p>
You can report a bug by
<a href="https://github.com/mondalaci/dxf2svg2kicad/issues/new" target="_blank">
opening a new issue</a>.<br>
Please attach the input file and include your browser name and its version number.<br>
GitHub being fairly anal, you can only attach images so rename your.dxf to your.dxf.png before attaching.
</p>
</div>
</li>
</ol>
</section>
<section id="ad">
<a href="https://UltimateHackingKeyboard.com" target="_blank"><img src="uhk-banner.jpg" /></a>
</section>
<div class="hidden">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ZTAD2MZYXCPH4">
<input type="submit" name="submit" id="paypal-submit" />
</form>
</div>
<script src="components/jquery/jquery.min.js"></script>
<script src="components/underscore/underscore-min.js"></script>
<script src="components/underscore.string/dist/underscore.string.min.js"></script>
<script> _.mixin(_.str.exports()); </script>
<script src="components/positional-format.js/positional-format.js"></script>
<script src="components/modernizr/modernizr.js"></script>
<script src="components/modernizr/feature-detects/blob-constructor.js"></script>
<script src="components/modernizr/feature-detects/file-api.js"></script>
<script src="components/FileSaver.js/FileSaver.js"></script>
<script src="node_modules/b-spline/index.js"></script>
<script src="scripts/pathseg.js"></script>
<script src="scripts/dxfToSvg.js"></script>
<script src="scripts/svgToKicadPcb.js"></script>
<script src="scripts/index.js"></script>
<script>
var _gaq=[['_setAccount','UA-606452-20'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src='//www.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>