From 771a62649ce092766b9efa11c302051039bc5483 Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Wed, 22 Sep 2021 18:34:15 +0200
Subject: [PATCH] Add center option to corner pipe

---
 HeatSink.scad | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/HeatSink.scad b/HeatSink.scad
index 3b3bd2e..1313450 100644
--- a/HeatSink.scad
+++ b/HeatSink.scad
@@ -286,7 +286,9 @@ module straightPipe(width, height, length, radius, strength, center=false) {
 // straightPipe(20, 10, 30, 1, 1);
 
 
-module cornerPipe(width, height, diameter, angle, radius, strength /* , center=false */) {
+// center only applies to Z-axis
+// TODO: write documentation!
+module cornerPipe(width, height, diameter, angle, radius, strength, center=false) {
   w = width;
   h = height;
   d = diameter;  // "size" of the corner. inner diameter of where it is virtually wound onto
@@ -294,14 +296,15 @@ module cornerPipe(width, height, diameter, angle, radius, strength /* , center=f
   r = radius;
   _str = strength;
   
+  tz = center ? 0 : h/2;
   
-  rotate_extrude(angle=a, convexity=8) translate([w/2 + d/2, 0, 0]) difference() {
+  translate([0, 0, tz]) rotate_extrude(angle=a, convexity=8) translate([w/2 + d/2, 0, 0]) difference() {
     roundRect(w, h, r);
     roundRect(w - _str*2, h - _str*2, r - _str);
   }
 }
 
-cornerPipe(20, 10, 5, 90, 1, 1);
+cornerPipe(20, 10, 5, 90, 1, 1, true);
 
 
 
-- 
GitLab