Diagram DSL — element examples

One runnable script per element — copy any block into the DSL panel (toolbar ▸ DSL). Elements are placed by relations: anchors coincide, axes align, endpoints stretch. See the full reference for all params and anchor names.

surface

A ground/table surface with hatch marks

canvas 360x160
surface ground x=40 y=100 w=280 h=14

incline / ramp

A 30° ramp with its automatic angle arc

canvas 400x220
incline ramp1 x=60 y_base=170 angle=30 run=280
30°

block

A labelled block seated on an incline — the solver finds the seat

canvas 400x230
incline ramp1 x=60 y_base=180 angle=30 run=280
block m1 on_incline=ramp1 at=0.55 w=70 h=45 label="m1"
30° m1

pulley

A pulley on a strut, pivoted at a ramp tip

canvas 400x240
incline ramp1 x=60 y_base=200 angle=30 run=240
pulley p1
p1.handle.endpoint = ramp1.tip
p1.handle.slope = 270
p1.handle.len = 30
30°

rope

Atwood-style rope routed over a pulley with through=

canvas 420x280
pulley p1 x=210 y=70 r=18
block m1 w=50 h=40 label="m1"
block m2 w=50 h=40 label="m2"
m1.center.x = p1.9oclock.x - 20
m2.center.x = p1.3oclock.x + 20
m1.top.y = p1.center.y + 60
m2.top.y = p1.center.y + 110
rope r1 from=m1.top to=m2.top through=p1
m1 m2

vector

Preset force vectors on a block — normal, gravity, friction

canvas 420x260
incline ramp1 x=60 y_base=210 angle=30 run=300
block m1 on_incline=ramp1 at=0.5 w=70 h=45 label="m1"
vector N  on=m1 preset=normal       len=60
vector W  on=m1 preset=gravity      len=75
vector Fr on=m1 preset=friction_up  len=48
30° m1

label

Anchored text placed relative to an element

canvas 360x160
block m1 x=140 y=60 w=80 h=50
label l1 pos=m1.top+(0,-10) text="mass m" size=13
label l2 pos=m1.center text="body" size=11
mass m body

angle_arc

An angle marker at a ramp vertex

canvas 400x200
incline ramp1 x=60 y_base=150 angle=35 run=280
angle_arc a1 at=ramp1.base_l from_deg=0 to_deg=-35 r=30 label="θ"
35° θ

line / spring

Construction lines stretch endpoints; springs coil between two points

canvas 400x200
line l1 x=60 y=150 x2=200 y2=150 dashed=1
spring s1 from=l1.b to=250,60 coils=6 amp=12
angle_arc a1 at=l1.b from_deg=180 to_deg=-60 r=22

lens

A closed-form thin-lens ray diagram — image position computed

canvas 480x260
lens l1 cx=240 cy=130 f=90 u=170 h_obj=60 lens_h=150
F2FF2FOI

mirror

Concave-mirror ray diagram (convex=1 flips it)

canvas 480x260
mirror m1 cx=380 cy=130 R=140 u=210 h_obj=55 half_deg=35
FCPOI

prism

Refraction through a triangular prism — Snell solved

canvas 480x260
prism p1 cx=240 base_y=190 A=60 mu=1.5 i=45 size=170
ABCPQRSδir₁r₂eA

wave

A sine wave with phase anchors (crest:0, node:1…)

canvas 400x160
wave w1 x=50 y=80 w=300 amp=28 cycles=2.5

mol

A molecule from the 300-compound library — double-click the sphere in the app for the interactive 3Dmol view

canvas 360x200
mol c1 mol=H2O pos=180,100 r=44 style=ballandstick
H2O3D

lewis

A textbook dot-and-bond structure with lone pairs

canvas 360x200
lewis l1 mol=H2O pos=180,100 size=60
OHH