Skip to content

Instantly share code, notes, and snippets.

@joe-warren
Created January 30, 2024 03:07
Show Gist options
  • Save joe-warren/5156e8eeff754c0137bb2622c2a20037 to your computer and use it in GitHub Desktop.
Save joe-warren/5156e8eeff754c0137bb2622c2a20037 to your computer and use it in GitHub Desktop.
import qualified Waterfall.TwoD.Path2D as Path2D
import qualified Waterfall.TwoD.Shape as Shape
import qualified Waterfall.Path as Path
import qualified Waterfall.Solids as Solids
import qualified Waterfall.Transforms as Transforms
import Waterfall.Booleans
import Waterfall.Sweep (sweep)
import Waterfall.IO (writeSTL)
import Linear
footR = 20
footOuterR = footR + 5
footChamfer = 5
heightChamfer = 5
heightPlatform = 170
heightBase = 100
heightTotal = heightPlatform-heightBase
heightLegs = 20
distanceCurve = 60
slotWidth = 15
base :: Shape.Shape
base = Shape.fromPath $ Path2D.pathFrom (V2 (footOuterR -footChamfer) footOuterR)
[ Path2D.lineTo (V2 footOuterR 0)
, Path2D.arcViaTo (V2 0 (-footOuterR)) (V2 (-footOuterR) 0)
, Path2D.lineTo (V2 (footChamfer-footOuterR) footOuterR)
, Path2D.lineTo (V2 (footOuterR -footChamfer) footOuterR)
]
line :: Path.Path
line = Path.pathFrom (V3 0 0 (-heightLegs))
[ Path.lineTo zero
, Path.bezierTo (V3 0 0 distanceCurve) (V3 distanceCurve 0 (heightTotal - distanceCurve)) (V3 distanceCurve 0 heightTotal)
, Path.lineRelative (V3 0 0 heightChamfer)
]
topHole :: Solids.Solid
topHole = Transforms.translate (V3 distanceCurve 0 heightTotal) $ Transforms.uScale footR Solids.unitCylinder
baseSlot :: Solids.Solid
baseSlot = Transforms.scale (V3 slotWidth (footOuterR * 4) (heightLegs * 4)) $ Transforms.translate (V3 0 0 (-0.5)) Solids.centeredCube
stand :: Solids.Solid
stand = (sweep line base `difference` topHole) `difference` baseSlot
main :: IO ()
main = writeSTL 0.1 "recordStand.stl" stand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment