aboutsummaryrefslogtreecommitdiff
path: root/gerboweb/templates/index.html
blob: fd5d4100edf0dc87a93fe15a2b33e9305c9c9c74 (plain)
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
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Gerbolyze Image to PCB Toolchain</title>
    <link rel="stylesheet" type="text/css" href="{{url_for('static', filename='style.css')}}">
    <link rel="icon" type="image/png" href="{{url_for('static', filename='favicon-512.png')}}">
    <link rel="apple-touch-icon" href="{{url_for('static', filename='favicon-512.png')}}">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <div class="layout-container">
      <div class="header">
        <div class="desc">
          <h1>SVG/JPG/PNG to PCB converter</h1>
          <p>
          This is the toy web frontend to <a href="https://github.com/jaseg/gerbolyze">Gerbolyze</a>.

      Gerbolyze is a tool for rendering arbitrary vector (SVG) and raster (PNG/JPG) images directly onto gerber layers.
      You can use this to put art on a PCB's silkscreen, solder mask or copper layers. The input is an SVG file
      generated from a template. This SVG file has one layer for each PCB layer and the layers are rendered one by one
      into the existing gerber file. SVG primitives are converted as-is with (almost) full SVG support, and bitmap
      images are vectorized using a vector halftone processor. Gerbolyze works with gerber files produced with any EDA
      toolchain and has been tested to work with both Altium and KiCAD.
          </p>
        </div>
      </div>

      {% with messages = get_flashed_messages(with_categories=True) %}
        {% if messages %}
          <div class="flashes">
            {% for category, message in messages %}
              <div class="flash flash-{{category}}">{{ message }}</div>
            {% endfor %}
          </div>
        {% endif %}
      {% endwith %}

      <form id="reset-form" method="POST" action="{{url_for('session_reset')}}" class="reset-form">{{reset_form.csrf_token}}</form>

      <div class="steps">
        <div class="step" id="step1">
          <div class="description">
            <h2>Upload zipped gerber files</h2>
            <p>
            First, upload a zip file containing all your gerber files. The default file names used by KiCAD, Eagle
            and Altium are supported.
            </p>
          </div>

          <div class="controls">
            <form id="gerber-upload-form" method="POST" action="{{url_for('upload_gerber')}}" enctype="multipart/form-data">
              {{gerber_form.csrf_token}}
            </form>
            <div class="form-controls">
              <div class="upload-label">Upload Gerber file:</div>
              <input class='upload-button' form="gerber-upload-form" name="upload_file" size="20" type="file">
            </div>
            <div class="submit-buttons">
              <input class='reset-button' form="reset-form" type="submit" value="Start over">
              <input class='submit-button' form="gerber-upload-form" type="submit" value="Submit">
            </div>
          </div>
        </div>

        {% if 'render_job' in session or has_renders %}
        <div class="step" id="step2">
          <div class="description">
            <h2>Download the target side's preview image</h2>
            <p>
              Second, download either the top or bottom SVG template and place your own artwork in it on the appropriate
              layers. The template is made to work well with the excellent open-source <a href="https://inkscape.org">Inkscape</a>
              vector graphics editor.  When you are done, upload your overlay below.

              If you wish to put a bitmap image (PNG/JPG) on your board, simply place it into the SVG on the appropriate
              layer. Make sure you select Inkscape's "embed image" option when importing it.
            </p>
          </div>
          <div class="controls">
            {% if 'render_job' in session %}
            <div class="loading-message">
              <div class="lds-ring"><div></div><div></div><div></div><div></div></div>
              <div><strong>Processing...</strong></div>
              <div>(this may take several minutes!)</div>
            </div>
            {% else %}
            <div class="preview-images">
              <a href="{{url_for('render_download', side='top')}}" onclick="document.querySelector('#side-0').checked=true" class="preview preview-top" style="background-image:url('{{url_for('render_preview', side='top')}}');">
                  <div class="overlay">top</div>
              </a>
              <a href="{{url_for('render_download', side='bottom')}}" onclick="document.querySelector('#side-1').checked=true" class="preview preview-bottom" style="background-image:url('{{url_for('render_preview', side='bottom')}}');">
                <div class="overlay">bot<br/>tom</div>
              </a>
            </div>
            {% endif %}
            <div class="submit-buttons">
              <input class='reset-button' form="reset-form" type="submit" value="Start over">
            </div>
          </div>
        </div>

        <div class="step" id="step3">
          <div class="description">
            <h2>Upload overlay SVG</h2>
            <p>
              Now, upload your binary overlay as an SVG and let gerbolyze paste it onto the target layers.
            </p>
          </div>
          <div class="controls">
            <form id="overlay-upload-form" method="POST" action="{{url_for('upload_overlay')}}" enctype="multipart/form-data">
              {{overlay_form.csrf_token}}
            </form>
            <div class="form-controls">
              <div class="form-label upload-label">Upload Overlay PNG file:</div>
              <input class='upload-button' form="overlay-upload-form" name="upload_file" size="20" type="file">
            </div>
            <div class="submit-buttons">
              <input class='reset-button' form="reset-form" type="submit" value="Start over">
              <input class='submit-button' form="overlay-upload-form" type="submit" value="Submit">
            </div>
          </div>
        </div>

        {% if 'vector_job' in session or has_output %}
        <div class="step" id="step4">
          <div class="description">
            <h2>Download the processed gerber files</h2>
          </div>
          <div class="controls">
            {% if 'vector_job' in session %}
            <div class="loading-message">
              <div class="lds-ring"><div></div><div></div><div></div><div></div></div>
              <div><strong>Processing...</strong></div>
              <div>(this may take several minutes!)</div>
            </div>
            {% else %}
            <div class='download-controls'>
              <a class='output-download' href="{{url_for('output_download')}}">Click to download</a>
            </div>
            {% endif %}
            <div class="submit-buttons">
              <input class='reset-button' form="reset-form" type="submit" value="Start over">
            </div>
            <!--4>Debug foo</h4>
            <div class="loading-message">
              <div class="lds-ring"><div></div><div></div><div></div><div></div></div>
              <div><strong>Processing...</strong></div>
              <div>(this may take several minutes!)</div>
            </div-->
          </div>
        </div>
        {% endif %} {# vector job #}
        {% endif %} {# render job #}
      </div>
      <div class="sample-images">
        <h1>Sample images</h1>
        <img src="{{url_for('static', filename='sample1.jpg')}}">
        <img src="{{url_for('static', filename='sample2.jpg')}}">
        <img src="{{url_for('static', filename='sample3.jpg')}}">
      </div>
    </div>
  </body>
</html>