Pull-eh 0.1.0: draw pulley constructions with CeTZ

I just finished preparing pull-eh (Github), a package helping you create the curves representing a rope stretching around wheels. Here’s an example from the manual:

Gun Tackle

To be honest the main reason I made this is that I already did the required geometric math and a diagram using it, and wanted to add the diagram to https://diagrams.janosh.dev/ (which has not happened yet) without putting all the math into the diagram itself – but should you find yourself needing to draw something like that, you’re welcome :slight_smile:

The biggest accomplishment in the package is IMO supporting arbitrary CeTZ coordinates. For example, the two ends of the left system are specified as (rel: (1.5, -2.5), to: "pulley1") (the loose end) and "block1.south" (the fixed one), which should make defining and later modifying such a graphic relatively painless.

9 Likes

Have you thought of a more realistic visualization where you have a concave pulley, so the string is invisible from the side view? Basically changing the radius ad which string goes.

Since I was thinking primarily of visualizing the physical system, i.e. forces acting on various parts, I considered the rope more important. But it’s of course trivial to change this. In fact, I already used CeTZ layers in the image I posted, so making the pulley partly obscure the rope literally only requires switching two numbers:

Gun Tackle - Concave pulleys

Or alternatively an even “deeper” pulley by using a larger radius for the circle than for the rope’s path:

Gun Tackle - Rope hidden in pulleys

Nice.

#import "@preview/cetz:0.3.4"
#import "@preview/pull-eh:0.1.0"

#cetz.canvas(length: 2cm, {
  import cetz.draw: *
  import pull-eh: *

  rotate(-65deg)

  let point = (0, 9)


  circle(name: "a", (5, 15), radius: 1, fill: purple)
  circle(name: "b", (5, 12), radius: 0.8, fill: blue)
  circle(name: "c", (5, 9), radius: 1, fill: green)

  let depth = 0.2
  on-layer(-1, wind(
    stroke: 2pt,
    point,
    (coord: "a", radius: 1 - depth) + cw,
    (coord: "c", radius: 1 - depth) + cw,
    (coord: "b", radius: 0.8 - depth) + cw,
    "c.north",
  ))
})

image

Now it just sounds like a yo-yo trick. Well, I think it definitely could be used for some, maybe.

1 Like