|
| 1 | +import { subtract, union } from '@jscad/modeling/src/operations/booleans' |
| 2 | +import { hull } from '@jscad/modeling/src/operations/hulls' |
| 3 | +import { translateZ } from '@jscad/modeling/src/operations/transforms' |
| 4 | +import { cuboid, cylinder } from '@jscad/modeling/src/primitives' |
| 5 | + |
| 6 | +const tablet = ( |
| 7 | + width: number, |
| 8 | + length: number, |
| 9 | + height: number, |
| 10 | + cornerRadius: number, |
| 11 | +) => |
| 12 | + hull([ |
| 13 | + cylinder({ |
| 14 | + height, |
| 15 | + segments: 64, |
| 16 | + radius: cornerRadius, |
| 17 | + center: [width / 2 - cornerRadius, length / 2 - cornerRadius, 0], |
| 18 | + }), |
| 19 | + cylinder({ |
| 20 | + height, |
| 21 | + segments: 64, |
| 22 | + radius: cornerRadius, |
| 23 | + center: [width / 2 - cornerRadius, -length / 2 + cornerRadius, 0], |
| 24 | + }), |
| 25 | + cylinder({ |
| 26 | + height, |
| 27 | + segments: 64, |
| 28 | + radius: cornerRadius, |
| 29 | + center: [-width / 2 + cornerRadius, length / 2 - cornerRadius, 0], |
| 30 | + }), |
| 31 | + cylinder({ |
| 32 | + height, |
| 33 | + segments: 64, |
| 34 | + radius: cornerRadius, |
| 35 | + center: [-width / 2 + cornerRadius, -length / 2 + cornerRadius, 0], |
| 36 | + }), |
| 37 | + ]) |
| 38 | + |
| 39 | +export const tabletHolder2 = () => { |
| 40 | + return [ |
| 41 | + translateZ( |
| 42 | + 6, |
| 43 | + union( |
| 44 | + subtract( |
| 45 | + tablet(254, 164, 12, 15), |
| 46 | + tablet(244, 154, 8, 10), |
| 47 | + cuboid({ |
| 48 | + size: [224, 154, 2], |
| 49 | + center: [0, 0, 5], |
| 50 | + }), |
| 51 | + cuboid({ |
| 52 | + size: [254, 154, 40], |
| 53 | + center: [0, -154 * (2 / 6), 0], |
| 54 | + }), |
| 55 | + cuboid({ |
| 56 | + size: [220, 35, 10], |
| 57 | + center: [0, 52.5, -5], |
| 58 | + }), |
| 59 | + ), |
| 60 | + cuboid({ |
| 61 | + size: [10, 135, 2], |
| 62 | + center: [0, 12.5, -5], |
| 63 | + }), |
| 64 | + cuboid({ |
| 65 | + size: [10, 135, 2], |
| 66 | + center: [-80, 12.5, -5], |
| 67 | + }), |
| 68 | + cuboid({ |
| 69 | + size: [10, 135, 2], |
| 70 | + center: [80, 12.5, -5], |
| 71 | + }), |
| 72 | + ), |
| 73 | + ), |
| 74 | + ] |
| 75 | +} |
0 commit comments