4 releases
0.2.4 | Jul 1, 2023 |
---|---|
0.2.3 | Jun 26, 2023 |
0.2.2 | Apr 29, 2023 |
0.2.1 | Mar 20, 2023 |
#45 in Data formats
37 downloads per month
22KB
261 lines
stationary-cam
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:
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
- When opening the SVG with GIMP, you can select the size of the picture.
- 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.
- File -> Import -> Scalable Vector Graphics (.svg)
- Select all objects
- Object Data Properties -> Resolution Preview U -> See console
- Right click -> Set Origin -> Geometry to Origin
- Right click -> Convert To -> Mesh
- Select cam object and select all vertices
- Press E to move them up a bit
- Select tooth object and select all vertices
- ALT-N -> Flip
- Press E to move them down a bit
- n times: Select each side or two vertices and merge to last
- Select all objects
- Control-M -> z
- Right click -> Join
- 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:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
Dependencies
~1.1–1.7MB
~31K SLoC