Created
May 2, 2019 17:25
-
-
Save peterkos/482218000d20a65129ca3c3a8e280394 to your computer and use it in GitHub Desktop.
Aperture Science luggage tag, for CSE 340
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rotate, translate, mirror (solid) | |
// union, | |
// difference (subtract shapes), | |
// hull (fills bounding box as tight as shape input) | |
// linear extrusion is a thing | |
// Inner triangle shape | |
// polygon(points=[[0, 0], [100, 0], [0, 100], | |
// [15, 15], [65, 16], [15, 65]], | |
// paths=[[0, 1, 2], [3, 4, 5]]); | |
// also can import a dxf file | |
// extrudding text works too! | |
// CHEAT SHEET: | |
// % shows something tarnsparently | |
// $fn sets resolution (lower for high perf) | |
// module name() {} // functon! | |
// Can use for loops | |
// Can use other people's libraries | |
use<roundedcube.scad>; | |
diameter = 60; | |
length = 100; | |
color("black", 0.3) | |
//difference() { | |
// hull() { | |
// translate([0, diameter / 2, 0]) | |
// cylinder(h = 2, d = diameter); | |
// translate([length, diameter / 2, 0]) | |
// cylinder(h = 2, d = diameter); | |
// } | |
// | |
// // Cirlce for nametag hole | |
// translate([length, diameter / 2, -2]) | |
// cylinder(h = 6, d = 20); | |
//} | |
color("red", 1) | |
linear_extrude(height = 5) | |
translate([27, diameter / 2 - 5, 0]) | |
text("Peter"); | |
//linear_extrude(height = 5) | |
//translate([0, diameter / 2 - 10, 3]) | |
//%text("tag", size = 5); | |
difference() { | |
hull() { | |
// Draw the nametag itself! | |
translate([length / 2, diameter / 2, 0]) | |
roundedcube([diameter * 1.8, diameter - 20, 1], true, 1.7, "z"); | |
} | |
// Cirlce for nametag hole | |
translate([(length / 2) + 40, diameter / 2, -5]) | |
cylinder(h = 10, d = 15); | |
} | |
// USING MODEL FROM HERE: | |
// https://www.thingiverse.com/thing:12414/files | |
// (with modified style, of course) | |
$fn = 120; | |
module aperture_logo(radius, thickness) | |
{ | |
beam_thickness = 0.07 * radius; | |
ratio = 0.6; | |
beam_x_dist = ratio*radius * cos(360/16) - beam_thickness/2; | |
rotate (12.5) | |
difference() { | |
cylinder(h = thickness, r = radius, center = true); | |
rotate(22.5) cylinder(h = thickness, r = radius * ratio, $fn = 8, center = true); | |
for (r = [0:45:315]) { | |
#rotate(r) | |
translate([/*radius * ratio - 5*/ beam_x_dist, ratio * radius, 0]) | |
cube([beam_thickness,radius,thickness], center = true); | |
} | |
}; | |
//translate([radius * 0.7 - 5,-0.5*radius,0]) cube([5,radius,5], center = true); | |
} | |
union() | |
{ | |
// Move the aperture logo and draw it | |
translate([(length / 2) - 37, diameter / 2, 3]) | |
aperture_logo(11, 7); | |
// These cylinders gave a bridge to connect | |
// all of the pieces. | |
// Since we're printing right onto the nametag, | |
// the nametag acts as the bridge. | |
translate([0,0,2]) | |
difference() | |
{ | |
//cylinder(h = 2, r = 12.5, center = true); | |
//cylinder(h = 2, r = 10, center = true); | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment