microphone_mount.hs
This is a mount that clips under the corner of a desk and holds a GS56S microphone.
#!/usr/bin/env stack
{- stack script --resolver lts-22.6
--package linear
--package waterfall-cad
--extra-dep waterfall-cad-0.4.0.0
--extra-dep opencascade-hs-0.4.0.0
-}
-- short-description: This is a mount that clips under the corner of a desk
-- short-description: and holds a GS56S microphone.
-- image: https://doscienceto.it/blog/photos/microphone-mount-01.jpg
import qualified Waterfall
import Linear
slotT :: Double
= 36
slotT
tableMount :: Waterfall.Solid
=
tableMount let tableR = 120 / (sqrt 2)
= 18
tableD = 20
width = 4
mountT = slotT + width
barD = let r = tableR + mountT in Waterfall.translate (unit _z ^* (-mountT))$ Waterfall.scale (V3 r r (tableD + mountT * 2)) Waterfall.unitCylinder
outerCyl = Waterfall.scale (V3 tableR tableR tableD) Waterfall.unitCylinder
innerCyl = let r = tableR - 20 in Waterfall.scale (V3 r r 100) Waterfall.unitCylinder
upperMask = outerCyl `Waterfall.difference` (innerCyl `Waterfall.union` upperMask)
cyl =
screwHole V3 1.5 1.5 100) Waterfall.centeredCylinder
Waterfall.scale (`Waterfall.union` (Waterfall.rotate (unit _x) pi$ Waterfall.uScale 100 $ Waterfall.unitCone)
=
bar xCo $
Waterfall.intersection cyl V3 xCo 0 0) $
Waterfall.translate (`Waterfall.difference` (Waterfall.translate (V3 0 (width/2) 0) screwHole)) $
(V3 width (tableR*2) 100) $
Waterfall.scale (^* 0.5) $
Waterfall.translate (unit _y
Waterfall.centeredCube= mconcat [bar x | x <- [barD/2, -barD/2]]
bars in bars
microphoneHolder :: Waterfall.Solid
=
microphoneHolder let outerR = 75/2
= 54/2
outerHoleR = 50/2
innerHoleR = 16
t = 4
plateaxD = Waterfall.roundFillet 4 $ Waterfall.scale (V3 outerR outerR t) $ Waterfall.unitCylinder
outerCyl = Waterfall.translate (unit _z ^* plateaxD) $ Waterfall.scale (V3 outerHoleR outerHoleR t) $ Waterfall.unitCylinder
outerHole = Waterfall.scale (V3 innerHoleR innerHoleR (t*3)) Waterfall.centeredCylinder
throughHole = outerCyl `Waterfall.difference` (throughHole `Waterfall.union` outerHole )
basicShape = Waterfall.scale (V3 slotT (outerR*2) (t*4)) $ Waterfall.translate (unit _y ^* 0.5) Waterfall.centeredCube
slot in basicShape `Waterfall.difference` slot
connectors :: Waterfall.Solid
=
connectors let
= 75/2
outerR = 16
t = 5
r = V3 outerR 0 t
start = 65
h = (V3 outerR 0 h)
end = Waterfall.arcVia start (V3 (100/2) 0 (h/2 + t/2)) end
path =
oneConnector 5 Waterfall.unitCircle) `Waterfall.union`
Waterfall.sweep path (Waterfall.uScale2D `Waterfall.union`
(Waterfall.translate start (Waterfall.uScale r Waterfall.unitSphere))
(Waterfall.translate end (Waterfall.uScale r Waterfall.unitSphere))in Waterfall.translate (V3 0 0 (-0.5)) $ mconcat [Waterfall.rotate (unit _z) angle oneConnector | angle <- [fromIntegral i * (pi/4) | i <- [3..5] <> [7..9] ]]
microphoneMount :: Waterfall.Solid
= tableMount `Waterfall.union` (Waterfall.translate (V3 0 50 (-70)) (microphoneHolder `Waterfall.union` connectors))
microphoneMount
partA :: Waterfall.Solid
= microphoneMount `Waterfall.intersection` (Waterfall.scale (V3 slotT 500 500) Waterfall.centeredCube)
partA
partB :: Waterfall.Solid
= microphoneMount `Waterfall.intersection` (Waterfall.translate (unit _x ^* (slotT/2)) $ Waterfall.uScale 500 $ Waterfall.translate (unit _x ^* 0.5) Waterfall.centeredCube)
partB
main :: IO ()
= do
main let stlRes = 0.1
"microphone_mount.stl" microphoneMount
Waterfall.writeSTL stlRes putStrLn "finished whole"
"microphone_mount_A.stl" partA
Waterfall.writeSTL stlRes putStrLn "finished part A"
"microphone_mount_B.stl" partB
Waterfall.writeSTL stlRes putStrLn "finished part B"