From 0ce148c1acbaf1e5ba3f0675d2465ab95e0b67e9 Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Thu, 16 Sep 2021 20:47:52 +0200
Subject: [PATCH] Implementing two-part extrudion process

---
 HeatSink.scad | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/HeatSink.scad b/HeatSink.scad
index e5fd3e9..f1a8ecd 100644
--- a/HeatSink.scad
+++ b/HeatSink.scad
@@ -15,6 +15,11 @@ hs_fin_d = 10;  // depth
 hs_fin_cnt = 10;
 hs_fin_spacing = 3;
 
+/**
+  *
+  * TODO: Moar documentation!
+  *
+  */
 module symmetricHeatsink(
   l = hs_l,
   w = hs_w,
@@ -48,6 +53,11 @@ module symmetricHeatsink(
 }
 
 
+/**
+  *
+  * TODO: Moar documentation!
+  *
+  */
 module roundRect(w, h, r) {
   _dw2 = (w - 2*r) / 2;
   _dh2 = (w - 2*r) / 2;
@@ -68,12 +78,7 @@ f_motor = 10;  // diameter of fan motor
 
 /**
   *
-  * TODO: connect the motor to the fan case
-  *   -> this needs splitting up the model into 2 layers
-  *   -> one for connecting the motor
-  *   -> and one for the general body
-  *   -> extrusion must become a 2-step process later on
-  *
+  * TODO: Moar documentation!!!
   * 
   * `layer`: either "Body" or "MotorConnection". the latter produces the bridges to the motor
   *
@@ -105,6 +110,11 @@ module fanProfile(
 }
 
 
+/**
+  *
+  * TODO: Moar documentation!!!
+  *
+  */
 module fan(
   d = f_d,
   r = f_r,
@@ -113,21 +123,23 @@ module fan(
   drill_wh = f_drill_wh,
   intake = f_intake,
   motor = f_motor,
+  layer_ratio = 0.1
 ) {
 
   // shadow original module here so we don't have to repeat the param list ^^
-  module _fanProfile(layer = "Body") {
-    fanProfile(d=d, r=r, wh=wh, drill=drill, drill_wh=drill_wh, intake=intake, motor=motor, layer=layer);
+  module _fanProfile(layer) {
+    fanProfile(r=r, wh=wh, drill=drill, drill_wh=drill_wh, intake=intake, motor=motor, layer=layer);
   }
 
+  if (layer_ratio > 0) translate([0, 0, d - d * layer_ratio]) linear_extrude(d * layer_ratio) _fanProfile("MotorConnection");
 
-  linear_extrude(d) _fanProfile();
-  
+  if (layer_ratio < 1) linear_extrude(d * (1 - layer_ratio)) _fanProfile("Body");  
 }
 
-fan();
 
 
 
+fan();
+
 // symmetricHeatsink();
 
-- 
GitLab