Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLVSX Constraint Solver Examples

A collection of examples demonstrating the SLVSX constraint solver for parametric design and mechanical systems.

View Interactive 3D Examples

What is SLVSX?

SLVSX is a command-line interface to the SolveSpace constraint solver. It allows you to define geometric relationships declaratively and have the solver calculate actual positions automatically.

Examples

Mechanical Linkages

Example Description Preview
Four-Bar Linkage Classic planar linkage with parametric crank angle SVG
Chebyshev Linkage Approximate straight-line mechanism SVG
Peaucellier Linkage First mechanism to convert rotary to exact straight line (1864) SVG
Theo Jansen Leg Strandbeest walking mechanism using "holy numbers" SVG
Crank-Slider Converts rotary to reciprocating motion (piston/engine) SVG
Scotch Yoke Converts rotation to linear motion via sliding yoke SVG
Whitworth Quick-Return Asymmetric motion for shaping machines SVG
Geneva Mechanism Maltese cross for intermittent motion SVG
Pantograph Rhombus linkage for copying/scaling drawings SVG
Cam Follower Radial cam with roller follower on vertical guide SVG
Ferris Wheel Six-cabin wheel with radial symmetry and support structure SVG

Gear Systems

Example Description Preview
Gear Mechanism Two meshing gears with proper tooth spacing SVG

Curves & Paths

Example Description Preview
Bezier Path Cubic Bezier S-curve with perpendicular control handles SVG
Tangent Arc Chain Arc-to-line tangent constraint for smooth transitions SVG

Artistic Patterns

Example Description Preview
Islamic Star Pattern 192 points, 88 lines - intricate geometric precision SVG
Parametric Flower Organic patterns from geometric constraints SVG
Spirograph Mathematical art patterns SVG
Iris Diaphragm Camera-style aperture mechanism SVG

Mechanical Parts

Example Description Preview
Symmetric Bracket Bracket with notch and mounting holes, demonstrating symmetry via parallel constraints SVG
Parametric Hinge 3D-printable hinge joint with configurable dimensions SVG

Complex Systems

Example Description Preview
Rube Goldberg Machine Chain-reaction with marble, bucket, lever, dominoes SVG
Constraint Showcase Demonstrates many constraint types in one file SVG

3D Structures

Example Description Preview
3D Scissor Lift 3-stage scissor with thick 3D bars (136 entities - largest demo!) SVG
Tetrahedron 4-faced polyhedron
Octahedron 8-faced polyhedron
Pyramid Square-based pyramid
3D Truss Structural truss in 3D

New Constraint Demos (v0.2.8)

Example Description Preview
Collinear Demo Points constrained to a single line using new collinear constraint SVG
Equal Angles Demo Radial spokes with equal angular spacing using new equal_angles constraint SVG

Architecture

Example Description Preview
Floor Plan Room layout with dimensional constraints SVG
Mandala Radial symmetry pattern SVG
Truss Bridge Structural bridge with triangulated support SVG

Learning Examples

Example Description
Basic Shapes Triangle, square, hexagon, pentagon - for learning constraint basics

Parametric Showcases

Examples showing the same design solved at different parameter values:

Example Description Preview
Four-Bar Animation Same linkage at 6 crank angles (0°, 60°, 120°, 180°, 240°, 300°) SVG
Prime Stars Radial patterns with 3, 5, 7, 11, 13 points using equal_angles SVG

Quick Start

Installation

# Install SLVSX
curl -fsSL https://raw.githubusercontent.com/snoble/slvsx-cli/main/install.sh | bash

# Clone examples
git clone https://github.com/snoble/slvx-examples.git
cd slvx-examples

Try It Out

# Solve a linkage
slvsx solve four_bar_linkage/four_bar_linkage.json

# Export to SVG
slvsx export -f svg four_bar_linkage/four_bar_linkage.json > output.svg
open output.svg

Creating Your Own Examples

Read the Visual Design Guide before creating examples.

Key Principles

  1. Build incrementally - Add entities one at a time, test after each
  2. Export to SVG - Visually inspect at every step
  3. Use parameters - Make key dimensions parametric
  4. Provide good initial guesses - Use at fields for points

Example Structure

{
  "schema": "slvs-json/1",
  "units": "mm",
  "parameters": {
    "link_length": 50,
    "angle": 30
  },
  "entities": [
    {"type": "point", "id": "origin", "at": [0, 0, 0]},
    {"type": "line", "id": "link", "p1": "origin", "p2": "end"}
  ],
  "constraints": [
    {"type": "fixed", "entity": "origin"},
    {"type": "distance", "between": ["origin", "end"], "value": "$link_length"}
  ]
}

Key Constraint Types

Constraint Purpose Example Use
fixed Anchor a point Origin, pivot points
distance Set distance between points Lengths, radii
angle Set angle between lines Rotations, slopes
perpendicular Make lines 90 degrees Right angles
parallel Make lines parallel Rails, guides
point_on_line Point lies on line Sliders, intersections
equal_length Make segments equal Regular polygons
midpoint Point at midpoint Centering
point_on_circle Point lies on circle Wheels, orbits
diameter Set circle diameter Sizing circles
tangent Make arc/line tangent Smooth transitions
collinear 3+ points on same line Rail alignment (v0.2.8+)
equal_angles Equal angles between lines Radial patterns (v0.2.8+)

Known Issues (v0.2.8)

See GitHub Issues for current bugs and feature requests.

Fixed in v0.2.8:

  • equal_length with >2 entities - FIXED! No longer crashes
  • point_on_line fails with 2D entities - FIXED in PR #50

Still Open:

  • symmetric_vertical/symmetric_horizontal collapse points (issue #49) - use parallel + fixed as workaround
  • Arc and cubic Bezier entities don't render in SVG export (issue #51) - entities solve correctly but SVG output doesn't show curves
  • rube_goldberg_machine example fails with "Invalid solver system" (issue #52)
  • Circles don't track points - use points for moving parts

Resources

License

Examples are provided as-is for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages