import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.* /** A tool to unlock trollies, that you can keep on your key-ring. Use the Customiser to change the values to mimic any coin. Print Notes : I printed mine solid, as I didn't want it to break while in the trolley! Usage : Insert the key, take your trolley, then swing the key round and pull it out. Make sure you take the trolley back after shopping! (Don't be a d**k) */ class TrollyKey : Model { @Custom var label = "£" @Custom var diameter = 22.45 @Custom var thickness = 3.0 // The handle's length, and width (at the shoulder) @Custom var handleSize = Vector2( 35, 6 ) @Custom var holeDiameter = 4.0 @Custom var chamfer = 0.5 override fun build() : Shape3d { val coin = Circle( diameter/2 ) val shoulder = Circle( diameter /2 - handleSize.y/2 ) .rightTo( -diameter*0.12 ).frontTo( handleSize.y/2 ) val handleY2 = handleSize.y / 2 + holeDiameter/2 val handle = PolygonBuilder().apply { moveTo(shoulder.middle.x+1, handleSize.y/2) lineTo( -handleSize.x, handleY2 ) circularArcTo( -handleSize.x, -handleY2, handleY2, true, true ) lineTo( shoulder.middle.x+1, -handleSize.y/2 ) }.build() val hole = Circle( holeDiameter/2 ).chamferedExtrude( thickness, -chamfer ) .leftTo( handle.left + 1.5 ) val profile = coin - shoulder.mirrorY().also() + handle val text = Text( label ).center().translateX(diameter*0.07).extrude( 0.6 ).topTo( thickness + 0.1 ) val result = profile.chamferedExtrude( thickness, chamfer ) - hole - text return result } override fun toString() = "Label : $label" }