FooCAD Source Codeclass BedHook() : Model {
val hookSize = Vector2( 30, 5 )
val hookThickness = 3
val indent = 4
@Slice( brimWidth=5 )
override fun build() : Shape3d {
val radius = hookSize.x/2 + hookThickness/2
val foo = radius*0.4
val profile = PolygonBuilder().apply {
circularArcBy( foo, foo, foo, false, true )
bezierBy( Vector2( 0, foo ), Vector2( 0, foo ), Vector2(-indent, radius ) )
lineBy( 0, radius*0.1 )
circularArcBy( radius *2, 0, radius, true, false )
lineBy( 0, -10 )
lineBy( 10, 10 )
}.buildPath().thickness( hookThickness ).rightTo(0).frontTo(0)
val handle = Square( 2, 20 )
.frontTo(profile.back -1)
.centerXTo(profile.middle.x-6)
val bulge = Circle( 4 ).centerXTo( handle.middle.x ).translateY( handle.back )
val withHandle = profile + handle + bulge
val hook = ExtrusionBuilder().apply {
crossSection( withHandle )
direction( Vector3( 1, 0, 2 ) )
forward( hookSize.y )
crossSection()
}.build()
return hook
}
}