From 4330fc7556800e646fcebaad8e29fc2e0c01a035 Mon Sep 17 00:00:00 2001 From: Petitgen Date: Sun, 2 Aug 2020 22:15:00 +1200 Subject: [PATCH] Add flatInside feature --- svg2cookiecutter.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/svg2cookiecutter.py b/svg2cookiecutter.py index 4cd775e..a9998a2 100755 --- a/svg2cookiecutter.py +++ b/svg2cookiecutter.py @@ -29,6 +29,8 @@ demouldingPlateHeight = 0; demouldingPlateSlack = 1.5; +flatInside = true; + // sizing function clamp(t,minimum,maximum) = min(maximum,max(t,minimum)); function featureThickness(t) = clamp(t,minFeatureThickness,maxFeatureThickness); @@ -61,11 +63,21 @@ cylinder(h=height,d=thickness,$fn=8); } } - for (i=[1:len(points)-1]) { - hull() { - translate(points[i-1]) profile(); - translate(points[i]) profile(); + module hullProfile() { + for (i=[1:len(points)-1]) { + hull() { + translate(points[i-1]) profile(); + translate(points[i]) profile(); + } + } + } + if (flatInside) { + difference() { + hullProfile(); + translate([0,0,-0.01]) linear_extrude(height=height + 0.02) polygon(points, h=height); } + } else { + hullProfile(); } }