From 6d59ea2bc8aefab41b40cce0a4105f4c5c2865b2 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 9 Jan 2021 18:43:43 +0000 Subject: [PATCH] Added render option to drag_chain_assembly(). --- printed/drag_chain.scad | 17 ++++++++++------- readme.md | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/printed/drag_chain.scad b/printed/drag_chain.scad index 6198135..7530faa 100644 --- a/printed/drag_chain.scad +++ b/printed/drag_chain.scad @@ -251,7 +251,7 @@ module drag_chain_link(type, start = false, end = false, check_kids = true) { // } // Need to use a wrapper because can't define nested modules in an assembly -module _drag_chain_assembly(type, pos = 0) { +module _drag_chain_assembly(type, pos = 0, render = false) { s = drag_chain_size(type); x = (1 + exploded()) * s.x; r = drag_chain_radius(type) * x / s.x; @@ -278,8 +278,11 @@ module _drag_chain_assembly(type, pos = 0) { module link(n) // Position and colour link with origin at the hinge hole translate([-z / 2, 0, -z / 2]) { stl_colour(n < 0 || n == npoints - 1 ? pp3_colour : n % 2 ? pp1_colour : pp2_colour) - drag_chain_link(type, start = n == -1, end = n == npoints - 1, check_kids = false) - let($fasteners = 0) children(); + render_if(render) + drag_chain_link(type, start = n == -1, end = n == npoints - 1, check_kids = false) + let($fasteners = 0) + children(); + let($fasteners = 1) children(); } @@ -307,15 +310,15 @@ module _drag_chain_assembly(type, pos = 0) { //! 1. Remove the support material from the links with side cutters. //! 1. Clip the links together with the special ones at the ends. -module drag_chain_assembly(type, pos = 0) //! Drag chain assembly +module drag_chain_assembly(type, pos = 0, render = false) //! Drag chain assembly assembly(str(drag_chain_name(type), "_drag_chain"), big = true) if($children == 2) - _drag_chain_assembly(type, pos) { + _drag_chain_assembly(type, pos, render) { children(0); children(1); } else if($children == 1) - _drag_chain_assembly(type, pos) + _drag_chain_assembly(type, pos, render) children(0); else - _drag_chain_assembly(type, pos); + _drag_chain_assembly(type, pos, render); diff --git a/readme.md b/readme.md index 33a459c..b9651f0 100644 --- a/readme.md +++ b/readme.md @@ -4559,7 +4559,7 @@ to the assembly, for example to add inserts. ### Modules | Module | Description | |:--- |:--- | -| `drag_chain_assembly(type, pos = 0)` | Drag chain assembly | +| `drag_chain_assembly(type, pos = 0, render = false)` | Drag chain assembly | | `drag_chain_link(type, start = false, end = false, check_kids = true)` | One link of the chain, special case for start and end | | `drag_chain_screw_positions(type, end)` | Place children at the screw positions, end = 0 for the start, 1 for the end | | `screw_lug(screw, h = 0)` | Create a D shaped lug for a screw |