Skip to content

Commit

Permalink
add 2D export option
Browse files Browse the repository at this point in the history
  • Loading branch information
whosawhatsis committed Feb 17, 2021
1 parent 887d49f commit 6a5016b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
32 changes: 23 additions & 9 deletions Circumscribed+inscribed/areaWedges.scad
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@ frame = 10;
$fs = .2;
$fa = 2;

for(a = [0:360 / sides:359]) rotate(a) translate([0, spacing / sin(360 / sides), 0]) if(a == 0) for(i = [1, -1]) translate([i * spacing / 3, 0, 0]) intersection() {
translate([i * r, r, 0]) cube(r * 2, center = true);
union() {
linear_extrude(thick / 2) wedge(true);
linear_extrude(thick) wedge();
for(a = [0:360 / sides:359]) rotate(a) translate([0, spacing / sin(360 / sides), 0]) if(a == 0) {
for(i = [1, -1]) translate([i * spacing / 3, 0, 0]) if(thick) {
intersection() {
translate([i * r, r, 0]) cube(r * 2, center = true);
union() {
linear_extrude(thick / 2) wedge(true);
linear_extrude(thick) wedge();
}
}
} else intersection() {
translate([i * r, r, 0]) square(r * 2, center = true);
wedge(true);
}
} else {
linear_extrude(thick / 2) wedge(true);
linear_extrude(thick) wedge();
if(thick) {
linear_extrude(thick / 2) wedge(true);
linear_extrude(thick) wedge();
} else wedge(true);
}

if(frame) linear_extrude(thick / 2) translate([1, 1, 0] * (-r - frame - spacing * (1 + 1 / sin(360 / sides)))) difference() {
if(frame) translate([1, 1, 0] * (-r - frame - spacing * (1 + 1 / sin(360 / sides)))) {
if(thick) linear_extrude(thick / 2) frame();
else frame();
}

module frame() difference() {
square([r + frame, r * PI + frame]);
translate([frame, frame, 0]) square([r, r * PI]);
translate([frame, frame, 0]) square([r + frame, r * PI + frame]);
}

module wedge(round = false) {
Expand Down
16 changes: 11 additions & 5 deletions Circumscribed+inscribed/circumscribed.scad
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ height = 10;
$fs = .2;
$fa = 2;

if(height) {
linear_extrude(height) outside();
linear_extrude(wall_thickness * 2) inside();
} else {
outside();
inside();
}

difference(){
cylinder(h = height, r = (radius + wall_thickness) / cos(180 / n), $fn = n);
cylinder(h = height*3, r = radius, $fn = 100, center = true);
module outside() difference(){
circle(r = (radius + wall_thickness) / cos(180 / n), $fn = n);
circle(r = radius, $fn = 100);
};


linear_extrude(wall_thickness * 2) intersection() {
module inside() intersection() {
circle(radius);
union() {
rotate(180 / n) translate([0, -wall_thickness, 0]) square([radius, 2 *wall_thickness]);
Expand Down
17 changes: 12 additions & 5 deletions Circumscribed+inscribed/inscribed.scad
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ height = 10;
$fs = .2;
$fa = 2;

difference(){
cylinder(h = height, r = radius + wall_thickness, $fn = 100);
cylinder(h = height * 3, r = radius, center = true, $fn = n);
};
if(height) {
linear_extrude(height) outside();
linear_extrude(wall_thickness * 2) inside();
} else {
outside();
inside();
}

module outside() difference() {
circle(r = radius + wall_thickness, $fn = 100);
circle(r = radius, $fn = n);
};

linear_extrude(wall_thickness * 2) intersection() {
module inside() intersection() {
circle(radius);
union() {
rotate(180 / n) translate([0, -wall_thickness, 0]) square([radius, 2 *wall_thickness]);
Expand Down

0 comments on commit 6a5016b

Please sign in to comment.