from code to coffee table with blender and sly
TRANSCRIPT
About Me
By day - Developer Experience at
Member of Pumping Station: One
Side projects involving electronics, music, woodworking, Python, cooking, visual art
https://www.youtube.com/watch?v=o1QxFu2VxCU
Conception
CNC enables novel construction methods that require unique, high precision parts.
Fabrication tools exist, but what about upstream design tools?
I want a new coffee table.
Fabrication Software
● Vectric VCarve - Convert vector images to G-code toolpaths
● ShopBot software - Calibrate axes and run G-code on the ShopBot
G-code (yuck!)
Study 1: ShopBotsaurus RexPattern via http://www.instructables.com/id/Build-a-6-0-tall-Wooden-T-Rex-Model/
Study 2: Design composeable parts
Create a 3D model in Blender
Use 123D Make to convert model into fab-able parts
Autodesk 123D Make
:-)● Free● Designed for CNC
construction● Many cool built-in
features
:-(● Unstable● GUI only● Hard to extend
A better design tool?
● Artistic/exploratory workflow ● Precise and reproducible operations● Output in a useful format (2D vector
shapes)● Aware of physical 3D concepts (e.g.
intersection)
bpy - Main Blender Python module
Programmatic equivalent of the GUI
Highly imperative - Operations apply to the global selection context
Great for macros/automation, not for complex apps
bmesh - Low level mesh interface
Meshes are Python objects
A BMesh object contains:- Vertices- Edges (2 verts)- Faces (3+ verts)
bmesh (cont’d)
Users must ensure mesh consistency
Tightly coupled to C data structures - be careful directly modifying mesh data!
http://www.blender.org/api/blender_python_api_2_73a_release/bmesh.html
bmesh.ops - BMesh Operations
Most GUI (bpy) ops have underlying BMesh implementations
(Mostly) well documented
Introducing Sly
A Python library for 3D construction from 2D parts
Uses Blender for I/O, but fairly decoupled
Only ~350 SLoC
Two core concepts
Slice - A 2D polygon (with thickness) positioned in 3D space.
Cut - Material to be removed from a slice so it can interlock with another slice
Extract slices from selected mesh
Apply an operation to each one
Add slices to vector output and Blender scene
Sly implementation (cont’d)
Shapely - http://toblerity.org/shapely/● Great polygon library● GIS-focused but general purpose● Support for geometric operations:
intersections, unions, etc.● Slices use Shaply polygons internally
Sly Roadmap
● Installer, tests, docs● Command line operation● Better Blender GUI integration● Smart slice placement● Output to G-code?● Different construction modes?
Want more?
In-depth sessions at PS:1 starting in April, email me to get notified: [email protected]
Contribute on GitHub: github.com/meshulam/sly