quest-two-mount.hs
Hook used to hang a Meta Quest 2 controller to a vertical length of 2020 t-slot.
{- 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: Hook used to hang a Meta Quest 2 controller to a vertical length of 2020 t-slot.
--
-- image: https://doscienceto.it/blog/photos/meta-quest-stand-01.jpg
-- image: https://doscienceto.it/blog/photos/meta-quest-stand-02.jpg
-- image: https://doscienceto.it/blog/photos/meta-quest-stand-03.jpg
import qualified Waterfall
import Linear
import Data.Function ((&))
import Control.Lens ((^.), (.~ ))
= V3 20 45 5
baseDims = 40
questR = 28 + 1
questT = 15 * pi / 180
questAngle = 5
hookEndT = 7
screwClearance = 6
hookThickness
mount :: Waterfall.Solid
=
mount let
| a ^. _xy == b ^. _xy = Just 5
cond (a, b) | a ^. _z > 0 = Just 2
| otherwise = Nothing
=
base
Waterfall.centeredCube & Waterfall.translate (0.5 *^ unit _z)
& Waterfall.scale baseDims
& Waterfall.roundConditionalFillet cond
= V3 questR questR (questT*4)
hookS = V3 hookThickness hookThickness 0
hookT = (baseDims ^. _z) + questT + hookEndT
hookH = Waterfall.centeredCylinder
hookShaft & Waterfall.scale hookS
& (`Waterfall.difference` (Waterfall.centeredCylinder & Waterfall.scale ((hookS - hookT) * V3 1 1 2)))
& Waterfall.translate (questR *^ unit _y)
& Waterfall.rotate (unit _x) questAngle
& Waterfall.intersection (Waterfall.centeredCube & Waterfall.translate (0.5 *^ unit _z) & Waterfall.scale (baseDims & _z .~ hookH))
= Waterfall.centeredCylinder
hookEnd & Waterfall.scale (hookS + V3 hookEndT hookEndT 0)
& (`Waterfall.difference` (Waterfall.centeredCylinder & Waterfall.scale ((hookS - hookT) * V3 1 1 2)))
& Waterfall.translate (questR *^ unit _y)
& Waterfall.rotate (unit _x) questAngle
& Waterfall.intersection (
Waterfall.centeredCube & Waterfall.translate (negate 0.5 *^ unit _z)
& Waterfall.scale (baseDims & _z .~ hookEndT)
& Waterfall.translate (hookH *^ unit _z)
)= (hookEnd <> hookShaft) & Waterfall.translate (7 *^ unit _y)
hook = mconcat [
baseHoles &
Waterfall.centeredCylinder V3 1.5 1.5 100) &
Waterfall.scale (<> (Waterfall.unitCylinder &
(V3 3 3 100) &
Waterfall.scale (^* (2) ))) &
Waterfall.translate (unit _z ^* (i * ((baseDims ^. _y)/2 - screwClearance)))
Waterfall.translate (unit _y | i <- [-1, 1]
]in (base <> hook) `Waterfall.difference` baseHoles
main :: IO ()
= Waterfall.writeSolid 0.01 "quest-two-mount.stl" mount main