Skip to content

Instantly share code, notes, and snippets.

vpype HPGL support

This is a design note related to the implementation of HPGL output support for vpype's write command. This WIP is tracked in this pull request.

The write command implements two related but distinct tasks:

  1. Page layout: includes the required scaling, translating and rotating to layout the geometries on a page of specified size and orientation in a predictable way.
  2. Output: generate actual SVG/HPGL output from the resulting geometries

The rest of this document describes the intended UI and behaviour once HPGL integration is completed.

@abey79
abey79 / stopmotion.py
Created April 30, 2020 16:56
Quick and (very!) dirty script to make stop motion from multi-layer files
import time
from pyaxidraw import axidraw
from gpiozero import LED
trigger = LED(26)
ad = axidraw.AxiDraw()
def take_photo():
@abey79
abey79 / axy.py
Created May 4, 2020 15:42
My pen is leaking (generative stop-motion animation with the axidraw)
import time
from pyaxidraw import axidraw
from gpiozero import LED
CM_TO_INCH = 1.0 / 2.54
trigger = LED(26)
ad = axidraw.AxiDraw()
ad.plot_setup()
@abey79
abey79 / dpx2x00.toml
Last active November 28, 2021 22:50
Roland DPX-2x00 config for vpype
# Notes from https://webmanual.rolanddg.com/contents/manuals/DPX-3700A+2700A_USE_E_R8.pdf
# * we use the default "DPX" origin system
# * paper_size: set to value from the X/Y columns (p.17)
# * for A3+ (where Xmm is paper long edge in mm and Ymm is paper short edge in mm):
# - x_range = (-Xmm * 20 - 480, Xmm * 20 - 480)
# - y_range = (-Ymm * 20, Ymm * 20
# * for A4:
# - x_range = (-Xmm * 20, Xmm * 20)
# - y_range = (-Ymm * 20 - 480, Ymm * 20 - 480)
# * origin_location: set to (-LLx, URy) from table on p. 17
@abey79
abey79 / geom-path-mgl.py
Last active April 21, 2024 17:49
ModernGL port of Nicolas Rougier's line drawing shader
"""
Port to ModernGL of: https://github.com/rougier/python-opengl/blob/master/code/chapter-09/geom-path.py
Background: https://github.com/rougier/python-opengl/blob/master/09-lines.rst
"""
import glm
import moderngl
import numpy as np
from PIL import Image
import functools
from typing import Type, Union, Sequence, Any, List, Dict
import moderngl as mgl
import numpy as np
class Uniform:
def __init__(self, shape: Union[int, Sequence[int]] = 1,
dtype: Union[np.dtype, Type, str] = "f4"):
@abey79
abey79 / vpype_1.9_brainstorm.md
Last active February 10, 2022 13:45
vpype 1.9 brainstorm

Here is a summary of how things are/will be soon, unless some kind of UX simplification happens:

Property substitution: uses the str.format() convention. Everywhere something like {propname} shows up, it's replaced with the corresponding property's value (from the current layer if any, or global otherwise). Supports things like {propname:.5f} and the rest of the str.format() mini-language.

Examples:

$ vpype read input.svg [...] write {vp_filename}_processed.svg
$ vpype [...] text "pen width: {vp_pen_width:.2f}" [...]
@abey79
abey79 / rerun_commit_todos.py
Last active November 30, 2023 10:06
Use rerun to track the number of "TODOs" in a code base across commits
from pathlib import Path
from git import Repo
import rerun as rr
GIT_REPO = Path("/tmp") / "rerun"
if not GIT_REPO.exists():