class PSUHack : Model { var size = Vector3(86.4, 39.7, 50.0) var endWidth = 10 var thickness = 1.6 @Piece fun end() : Shape3d { return Cube( size.x, size.y, endWidth ).center() - Cube( size - Vector3( thickness, thickness, endWidth+1 ) * 2 ) .center().translateZ( thickness ) } @Piece fun main() : Shape3d { val outside = Cube( size + Vector3( thickness, thickness, 0 ) * 2 ).centerXY() val inside = Cube( size ) .centerXY().translateZ( thickness ) val padHoles = Cylinder( 10, 1.5 ).center() and Cylinder( 100, 3 ).translate(7,7,-100).mirrorX().also().mirrorY().also() and Cylinder( 100, 4 ).rotateX(90).translate(6,10,-4).mirrorX().also() val pad = (Cube(25, 25, 6 ).centerXY() remove padHoles) .rotateX(90).bottomTo(0).translateY(6-size.y/2) .translateX(-size.x/4) // Layout3d doesn't play nicely with Cavity3d :-( Nor does "also" // So we've had to avoid using them. // Hopefully this will be fixed in a later version of foocad. val pads = pad and pad.mirrorX() return (outside-inside) and pads } override fun build() = main() }