import static uk.co.nickthecoder.foocad.circular.v1.Circular.* import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* import uk.co.nickthecoder.foocad.extras.v1.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* class SpoolRing : Model { @Custom( about="Diameter and thiickness for the carboard to fit within") var size = Vector2( 195, 5 ) @Custom( about="Width and thickness of the base" ) var baseSize = Vector2( 7, 0.8 ) @Custom( about="How are the filament holes from the outside of the spool" ) var holeOffset = 7.0 @Custom( about="Determines the separation of the filament holes in degrees" ) var holeAngle = 38 @Custom( about="Thickness of the walls" ) var thickness = 2 @Custom( about="Size of the 3 tabs" ) var tabSize = Vector3( 38, 2, 2.5 ) override fun build() : Shape3d { //val from3dqf = STLParser().parseFile( "MK19_Spool.stl" ) // .translateZ(10).color("LightBlue").opacity(0.2) val inner = Circle( size.x / 2 ) val outside = inner.offset( thickness ) val ringInner = inner.offset( -baseSize.x ) val holeShape = Square( 23, 3.5 ) .center() .roundAllCorners(1) .resolutionX(1) .aroundCircle( size.x / 2 - holeOffset ) .rotate(holeAngle/2) .mirrorX().also() val holeOutlineShape = holeShape.offset(2.5) val ring = (outside-ringInner+holeOutlineShape-holeShape).extrude( baseSize.y ) val wall = (outside - inner) .smartExtrude( size.y ) .outsideTop( roundedChamfer(thickness) ) .bottomTo( ring.top ) val tab = Square( tabSize.x, tabSize.y + thickness/2 ) .frontTo(-tabSize.y) .roundCorner(1,tabSize.y) .roundCorner(0,tabSize.y) .resolutionX(1) .centerX() .extrude( tabSize.z ) .aroundCylinder( size.x / 2 ) val tabs = tab .repeatAroundZ(3) .topTo( wall.top ) val chamferTabs = Cylinder( tabSize.z -0.4, size.x/2, size.x/2 - tabSize.y ) .bottomTo(tabs.bottom - 0.01) return ring + wall + tabs - chamferTabs // + from3dqf } }