2.4 KiB
HPGL Plotter Web UI
Flask web interface for uploading HPGL files, previewing and transforming them (flip, rotate, scale, center), and sending to the plotter. Intended to run on a Raspberry Pi connected to the plotter via USB.
Setup (Raspberry Pi)
-
From the project root (mimaki/), install dependencies:
If you get externally-managed-environment (Python 3.11+ / PEP 668) and don’t want a venv, use:
pip install --break-system-packages -r webui/requirements.txtOtherwise:
pip install -r webui/requirements.txtOptional – use a venv to avoid touching system Python:
python3 -m venv venv source venv/bin/activate pip install -r webui/requirements.txt -
Config: Copy
config.example.initoconfig.iniand adjust (port, baudrate, web UI host/port, etc.).config.iniis gitignored.cp config.example.ini config.iniEdit
config.inito set the plotter port (e.g./dev/ttyUSB0) and optionally web UI port/host.
Run
From the project root (mimaki/):
python webui/app.py
Then open http://<raspi-ip>:5000 in a browser (e.g. http://192.168.1.10:5000).
- Host:
0.0.0.0so other devices on the network can connect. - Port: 5000 (override with
PORT=8080 python webui/app.pyif needed).
For production, run behind gunicorn and optionally a reverse proxy:
pip install --break-system-packages gunicorn # or omit if not using system Python
gunicorn -w 1 -b 0.0.0.0:5000 "webui.app:app"
Usage
- Upload – Choose an
.hpglor.pltfile. It is validated and stored inwebui/uploads/. - Preview – The drawing is converted to SVG and shown in the browser.
- Transform – Flip, Rotate 90° / 180°, Scale + / −, Center. Each action updates the stored program and the preview.
- Print – Sends the current (transformed) program to the plotter: scale to fit, center, then write HPGL to serial.
API
POST /api/upload– Upload HPGL file (form fieldfile).GET /api/svg– Get current program as SVG (query:width,height).POST /api/transform– Body:{"action": "flip"|"rotate"|"scale"|"centralize", "angle": 90, "factor": 1.25}.POST /api/print– Send current program to plotter.GET /api/status–has_file,filename,plotter_ready.
Session is used to keep the current file path; no database.