daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Aug 11th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const outerRadius = 8.9 / 2;
  2. const ringHeight = 1.2;
  3. const innerRadius = 7.26 / 2;
  4. const stopperHeight = 0.3;
  5.  
  6. function innerRing(offset = 0) {
  7.   return cylinder({ r1: innerRadius + offset, r2: innerRadius + offset, h: ringHeight * 2, fn: 128 }).translate([
  8.     0,
  9.     0,
  10.     -ringHeight
  11.   ]);
  12. }
  13.  
  14. function innerTab() {
  15.   const w = 2;
  16.   const tabDepth = 0.075;
  17.   const tabHeight = 0.8;
  18.   return intersection(
  19.     cube({ size: [innerRadius + tabDepth, w, tabHeight] }).translate([0, -w / 2, -stopperHeight]),
  20.     innerRing(tabDepth)
  21.   );
  22. }
  23.  
  24. function innerTabStop() {
  25.   const w = 1;
  26.   return cube({ size: [1, w, 0.45] })
  27.     .translate([innerRadius - 0.5, -w / 2, -stopperHeight - 0.05])
  28.     .rotateX(1.5);
  29. }
  30.  
  31. function ring() {
  32.   const stopperRadius = 9.6 / 2;
  33.   const innerTabStopAngle = 68.15;
  34.   return union(
  35.     difference(
  36.       union(
  37.         cylinder({ r1: outerRadius, r2: outerRadius, h: ringHeight, fn: 128 }),
  38.         cylinder({ r1: stopperRadius, r2: stopperRadius, h: stopperHeight, fn: 128 }).translate([0, 0, -stopperHeight])
  39.       ),
  40.       innerRing(),
  41.       innerTab().rotateZ(60),
  42.       innerTab().rotateZ(60 + 120),
  43.       innerTab().rotateZ(60 + 240)
  44.     ),
  45.     difference(
  46.       union(
  47.         innerTabStop().rotateZ(innerTabStopAngle),
  48.         innerTabStop().rotateZ(innerTabStopAngle + 120),
  49.         innerTabStop().rotateZ(innerTabStopAngle + 240)
  50.       ),
  51.       innerRing(),
  52.       cylinder({ r1: stopperRadius, r2: stopperRadius, h: stopperHeight, fn: 128 }).translate([
  53.         0,
  54.         0,
  55.         -stopperHeight * 2
  56.       ])
  57.     )
  58.   );
  59. }
  60.  
  61. function tab() {
  62.   const w = 1.5;
  63.   const tabDepth = 0.2;
  64.   const tabHeight = 0.4;
  65.   return intersection(
  66.     difference(
  67.       cube({ size: [outerRadius + tabDepth, w, tabHeight] })
  68.         .translate([0, -w / 2, ringHeight / 2 - tabHeight / 2])
  69.         .rotateX(2.5)
  70.         .setColor(1, 0, 0),
  71.       innerRing()
  72.     ),
  73.     cylinder({ r1: outerRadius + tabDepth, r2: outerRadius + tabDepth, h: ringHeight, fn: 128 })
  74.   );
  75. }
  76.  
  77. function main() {
  78.   return union(ring(), tab().rotateZ(120), tab().rotateZ(240), tab());
  79. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top