Skip to content

CITROMOSEPER/XYdraw-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XYdraw Editor

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.


Features

2D Editor

  • 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)

3D Editor

  • 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

Project & Export

  • 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 / .ino file

Requirements

  • Python 3.10 or later
  • Tkinter (included with most Python installations)
  • No additional third-party packages

Installation

git clone https://github.com/CITROMOSEPER/XYdraw-editor.git
cd XYdraw-editor
python main.py

On Linux, if Tkinter is missing:

sudo apt install python3-tk

Usage

  1. Create objects — use Project → New 2D Object or New 3D Object. Rename, reorder, or delete objects by right-clicking them in the sidebar.
  2. Draw — select a tool from the toolbar and click / drag on the canvas.
  3. Preview occlusion — for 3D objects, toggle View → 3D Occlusion to see the hidden-line-removed view that matches real hardware output.
  4. Import geometry — with a 3D object selected, use File → Import 3D file… to load an .obj or .stl mesh.
  5. 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().

Exported code example

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.


Project File Format

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.


Keyboard Shortcuts

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

Related


Author

Nemes Dániel

About

Visual GUI editor for the XYdraw Arduino library. Draw 2D shapes and 3D scenes on a canvas, import OBJ/STL meshes, preview occlusion, and export ready-to-paste C++ code for oscilloscope vector graphics on ESP32. Requires Python 3.10+ and Tkinter.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages