/stationary-cam

This safe Rust CLI generates SVG templates for stationary cams.

Primary LanguageRustApache License 2.0Apache-2.0

stationary-cam

License: MIT/Apache Crates.io

This safe Rust CLI generates SVG templates for stationary cams.

Example

cargo install stationary-cam
~/.cargo/bin/stationary-cam \
    --filename "example" \
    --strokes \
        "S1=M 5,0 L 5,30" \
        "S2=M 5,0 L 5,30" \
        "S3=M 5,0 L 5,30" \
        "S4=M 5,0 L 5,30" \
        "S5=M 5,0 L 5,30" \
        "S6=M 5,0 L 5,30" \
        "S7=M 5,0 L 5,30" \
        "S8=M 5,0 L 5,30" \
        "S9=M 5,0 L 5,30" \
        "S10=M 5,0 L 5,30" \
    --diameter-mm 460 \
    --center-circle-radius-mm 18.0 \
    --outer-circles-radius-mm 5.0 \
    --outer-circles-margin-mm 50.0 \
    --vertices-per-millimeter 1

This will result in a SVG looking like this:

Result

Building the cam

You can use the generated SVG template to cut the cam out of a metal plate, cardboard or any other material. Depending on the material of the cam, you might need a different file format.

Using GIMP to convert the SVG to PNG

  1. When opening the SVG with GIMP, you can select the size of the picture.
  2. File -> Export As... -> example.png

Using Blender to convert the SVG to OBJ or STL

OBJ and STL files are often used for 3D printing or CNC woodworking.

  1. File -> Import -> Scalable Vector Graphics (.svg)
  2. Select all objects
  3. Object Data Properties -> Resolution Preview U -> See console
  4. Right click -> Set Origin -> Geometry to Origin
  5. Right click -> Convert To -> Mesh
  6. Select cam object and select all vertices
  7. Press E to move them up a bit
  8. Select tooth object and select all vertices
  9. ALT-N -> Flip
  10. Press E to move them down a bit
  11. n times: Select each side or two vertices and merge to last
  12. Select all objects
  13. Control-M -> z
  14. Right click -> Join
  15. File -> Export -> e.g. Wavefront OBJ / STL etc.

Using Inkscape to convert the SVG to DXF

DXF files are often used for metal laser cutting machines.

inkscape --export-type="dxf" example.svg

License

Licensed under either of these:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.