A desktop GUI editor for designing 2D and 3D graphics for the XYdraw Arduino library — which renders vector images on an oscilloscope in XY mode using an ESP32's DAC pins.
Instead of writing coordinates by hand, you draw shapes visually and the editor generates ready-to-paste C++ function code.
- Draw lines, rectangles, circles, ellipses, cubic Bézier curves, and raster pixel grids
- Click-to-select, drag-to-move, resize handles on all shapes
- Vertex snapping / magnetism with adjustable threshold
- Oscilloscope-style grid overlay
- Undo / redo (up to 80 steps per object)
- Place 3D line segments and triangular polygon faces with a full orbit camera (RMB drag = orbit, MMB = pan, scroll = zoom)
- Occlusion preview — matches the scene-buffered hidden-line removal of the library exactly
- Translation, rotation, and scale gizmos on selected elements
- Import OBJ and STL files — meshes are auto-centred, auto-scaled, and fan-triangulated; each triangle becomes an individually editable polygon element
- Vertex snapping across elements
- Multiple named 2D and 3D objects per project, reorderable in the sidebar
- Projects saved as
.xyd(JSON) files — occlusion state, magnetism distance, and refine quality are all stored per file - Export generates a C++ function using the XYdraw API: choose static or offset coordinates, Allman or K&R brace style, and the object variable name
- Copy to clipboard or save / append directly to a
.cpp/.inofile
- Python 3.10 or later
- Tkinter (included with most Python installations)
- No additional third-party packages
git clone https://github.com/CITROMOSEPER/XYdraw-editor.git
cd XYdraw-editor
python main.pyOn Linux, if Tkinter is missing:
sudo apt install python3-tk- Create objects — use Project → New 2D Object or New 3D Object. Rename, reorder, or delete objects by right-clicking them in the sidebar.
- Draw — select a tool from the toolbar and click / drag on the canvas.
- Preview occlusion — for 3D objects, toggle View → 3D Occlusion to see the hidden-line-removed view that matches real hardware output.
- Import geometry — with a 3D object selected, use File → Import 3D file… to load an
.objor.stlmesh. - Export — select an object and click Export… in the menu bar. Copy the generated C++ function into your Arduino sketch and call it from
loop().
void render_my_object()
{
XYdraw.circle(128, 128, 60);
XYdraw.rectangle(50, 50, 156, 156);
}For 3D objects with occlusion, the exporter produces add_*_to_scenebuffer calls that pair with render_scenebuffer() in your sketch.
Projects are saved as .xyd files (plain JSON). Each file stores:
- All objects and their elements (full coordinate data)
- Refine quality setting
- Occlusion on/off state
- Magnetism snap distance
Old .xyd files without the newer settings fields are loaded with sensible defaults and remain fully compatible.
| Shortcut | Action |
|---|---|
| Ctrl+N | New project |
| Ctrl+O | Open project |
| Ctrl+S | Save |
| Ctrl+Shift+S | Save As |
| Ctrl+Z | Undo |
| Ctrl+Y | Redo |
| Ctrl+A | Select all elements |
| Ctrl+C / X / V | Copy / Cut / Paste elements |
| Esc | Switch to Select tool |
| Delete / Backspace | Delete selected elements |
- XYdraw Arduino library — github.com/CITROMOSEPER/XYdraw
Nemes Dániel