From 886319a6e48d94a7070ba2eef24275a750b8c904 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Fri, 19 Jul 2019 10:37:10 +0100 Subject: [PATCH] Added pose_vflip() and pose_hflip() to make posing assembly views easier. --- readme.md | 2 ++ utils/core/bom.scad | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/readme.md b/readme.md index 55bd02c..5fae935 100644 --- a/readme.md +++ b/readme.md @@ -4366,6 +4366,8 @@ heirachical BOMs are also generated for real projects. | ```no_pose()``` | Force children not to be posed even if parent is | | ```not_on_bom(on = false)``` | Specify the following child parts are not on the BOM, for example when they are on a PCB that comes assembled | | ```pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef)``` | Pose an STL or assembly for rendering to png by specifying rotation ```a``` and translation ```t```, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. | +| ```pose_hflip(exploded = undef)``` | Pose an STL or assembly for rendering to png by flipping around the Y axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. | +| ```pose_vflip(exploded = undef)``` | Pose an STL or assembly for rendering to png by flipping around the X axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. | | ```stl(name)``` | Name an stl that will appear on the BOM, there needs to a module named ```_stl``` to make it | | ```vitamin(description)``` | Describe a vitamin for the BOM entry and precede it with a module call that creates it, eg. "wigit(42): Type 42 widget" | diff --git a/utils/core/bom.scad b/utils/core/bom.scad index 6044e14..a3b338e 100644 --- a/utils/core/bom.scad +++ b/utils/core/bom.scad @@ -63,6 +63,22 @@ module pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef) //! Pose an translate(-t) children(); +module pose_hflip(exploded = undef) //! Pose an STL or assembly for rendering to png by flipping around the Y axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. + if(is_undef($pose) || !is_undef($posed) || (!is_undef(exploded) && exploded != !!exploded())) + children(); + else + let($posed = true) // only pose the top level + hflip() + children(); + +module pose_vflip(exploded = undef) //! Pose an STL or assembly for rendering to png by flipping around the X axis, ```exploded = true for``` just the exploded view or ```false``` for unexploded only. + if(is_undef($pose) || !is_undef($posed) || (!is_undef(exploded) && exploded != !!exploded())) + children(); + else + let($posed = true) // only pose the top level + vflip() + children(); + module assembly(name) { //! Name an assembly that will appear on the BOM, there needs to a module named ```_assembly``` to make it if(bom_mode())