https://github.com/34j/typst-cetz-mechanical-system
CeTZ library for drawing mechanical systems.
https://github.com/34j/typst-cetz-mechanical-system
cetz typst
Last synced: about 2 months ago
JSON representation
CeTZ library for drawing mechanical systems.
- Host: GitHub
- URL: https://github.com/34j/typst-cetz-mechanical-system
- Owner: 34j
- License: mit
- Created: 2025-01-06T05:21:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-25T12:12:20.000Z (about 2 months ago)
- Last Synced: 2026-04-25T12:17:12.450Z (about 2 months ago)
- Topics: cetz, typst
- Language: Typst
- Homepage:
- Size: 67.4 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Typst CeTZ Mechanical System
CeTZ library for drawing mechanical systems.
## Usage
```typst
#import "@preview/cetz-mechanical-system-34j:*.*.*": spring, damper, wall, wire
#import "@preview/cetz:0.5.0"
#set page(paper: "jis-b9", flipped: true)
#set align(center + horizon)
#cetz.canvas({
import cetz.draw: *
circle((0, 0), radius: 0.3, name: "mass1")
spring((0.5, 0), name: "spring1", n: 8, inverse: false)
circle((2, 0), radius: 0.3, name: "mass2")
spring((3, -0.5), name: "spring2", n: 7)
damper((3.15, 0.5), name: "damper", inverse: true)
wall((5, -1.2), b: (5, 1.2), name: "wall", inverse: false, inverse-lines: false)
line("mass1", "spring1")
line("spring1", "mass2")
line("spring1", "mass2")
wire("mass2", "spring2")
wire("mass2", "damper")
wire("spring2", "wall")
wire("damper", "wall")
content("mass1", $M_1$)
content("mass2", $M_2$)
content("spring1.bottom", $k_1$)
content("spring2.bottom", $k_1$)
content("damper.top", $c_1$)
})
```
