Skip to content

Instantly share code, notes, and snippets.

@reidab
Created April 15, 2023 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reidab/f6727877e6cd7a559f00f2f94cbe6f2b to your computer and use it in GitHub Desktop.
Save reidab/f6727877e6cd7a559f00f2f94cbe6f2b to your computer and use it in GitHub Desktop.
import vsketch
import numpy as np
class DDepthSketch(vsketch.SketchClass):
def draw(self, vsk: vsketch.Vsketch) -> None:
vsk.size("letter", landscape=False, center=False)
vsk.scale("in")
# vsk.rect(4.25, 5.5, 5.5, 5.5, mode='center')
for i in range(1, 100):
vsk.stroke(i)
w1 = 5
h1 = 4.25
s = 2
w2 = w1 - s
h2 = h1 - s
x = 4.25
y = 5.39
bw = 1
bh = h1
d = vsk.createShape()
d.arc(x, y, w1, h1, -91, 91, degrees=True, close='chord')
d.rect(x - bw, y - bh / 2, bw, bh)
d.arc(x, y, w2, h2, -91, 91, degrees=True, close='chord', op='difference')
d.rect(x - bw * 2, y - h2 / 2, bw * 2, h2, op='difference')
vsk.shape(d)
vsk.vpype("pspread 0.5cm perspective --hfov 60 --pan -6.5 --tilt -4 occult -i color blue")
def finalize(self, vsk: vsketch.Vsketch) -> None:
vsk.vpype("linemerge linesimplify reloop linesort")
if __name__ == "__main__":
DDepthSketch.display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment