1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-13 19:03:58 +02:00

Can now inhibit exploded lines for issue #220.

This commit is contained in:
Chris Palmer
2022-02-23 23:52:25 +00:00
parent 6850953e71
commit f173284709
2 changed files with 9 additions and 8 deletions

View File

@@ -6787,7 +6787,7 @@ The `pose()` module allows assembly views in the readme to be posed differently
|:--- |:--- |
| `assembly(name, big = undef, ngb = false)` | Name an assembly that will appear on the BOM, there needs to a module named `<name>_assembly` to make it. `big` can force big or small assembly diagrams. |
| `dxf(name)` | Name a dxf that will appear on the BOM, there needs to a module named `<name>_dxf` to make it |
| `explode(d, explode_children = false, offset = [0,0,0])` | Explode children by specified Z distance or vector `d`, option to explode grand children |
| `explode(d, explode_children = false, offset = [0,0,0], show_line = true)` | Explode children by specified Z distance or vector `d`, option to explode grand children |
| `hidden()` | Make item invisible, except on the BOM |
| `no_explode()` | Prevent children being exploded |
| `no_pose()` | Force children not to be posed even if parent is |

View File

@@ -49,17 +49,18 @@ function show_supports() = !$preview || exploded(); //! True if
module no_explode() //! Prevent children being exploded
let($exploded_parent = true) children();
module explode(d, explode_children = false, offset = [0,0,0]) { //! Explode children by specified Z distance or vector `d`, option to explode grand children
module explode(d, explode_children = false, offset = [0,0,0], show_line = true) { //! Explode children by specified Z distance or vector `d`, option to explode grand children
v = is_list(d) ? d : [0, 0, d];
o = is_list(offset) ? offset : [0, 0, offset];
if(exploded() && norm(v)) {
translate(o) // Draw the line first in case the child is transparent
color("yellow") hull() {
sphere(0.2);
translate(v * exploded())
if(show_line)
translate(o) // Draw the line first in case the child is transparent
color("yellow") hull() {
sphere(0.2);
}
translate(v * exploded())
sphere(0.2);
}
translate(v * exploded())
let($exploded_parent = explode_children ? undef : true)