class LEDGroundSpike : Model { @Custom var length = 100 var diameter = 20.5 var height = 20 @Custom( about="This is the weakest part, so not too thin!" ) var topT = 4 @Custom( about="Thickness of the blades of the spike. Doesn't need to be as thick as topT" ) var spikeT = 2.4 fun cross( size : double ) = Square( size, spikeT ).center().rotate(90).also() override fun build() : Shape3d { var top = ExtrusionBuilder().apply { crossSection( Circle( diameter/2 ) ) forward( height ) crossSection() forward(1) crossSection(1) forward(1) crossSection() forward(diameter) crossSection( -diameter/2 ) }.build() val point = ExtrusionBuilder().apply { crossSection( cross(diameter) ) forward( length - diameter * 2 ) crossSection() forward( diameter*2 ) crossSection( cross(spikeT+0.1) ) forward(spikeT*2) crossSection( Square(0.001) ) }.build().bottomTo( height + 2 ) val hole = Cube( diameter, diameter, height+diameter+2 ) .translate(spikeT/2,spikeT/2,0) .rotateZ(180).also() val coreD = diameter - topT * 2 val core = Cylinder( height + 5, coreD/2 ) + Cylinder( diameter-topT*2, coreD/2, 0 ).bottomTo( height + 5 ) val brim = Cylinder( 0.2, 20 ) return top + point - hole - core + brim } }