import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.* class CurtainHooks : AbstractModel() { var hookThickness = 3.0 var hookChamfer = 0.4 var gliderTabThickness = 2.0 @Piece fun hook() : Shape3d { return SVGParser().parseFile( "CurtainHooks.svg" ) .shapes["hook"] .center() .chamferedExtrude( hookThickness, hookChamfer ) .color( "Yellow" ) } @Piece fun glide() : Shape3d { val doc = SVGParser().parseFile( "CurtainHooks.svg" ) //println( "Names = ${doc.shapes.keySet()}" ) val main2d = ( doc.shapes["glideHead"] + doc.shapes["glideNeck"] + doc.shapes["glideTail"] ) val profile = doc.shapes["glideProfile"].toOrigin() .extrude( main2d.size.y ) val main = main2d.toOrigin().extrude(profile.size.z) .rotateX(90).frontTo(0) val tab = doc.shapes["glideTab"].translate(-main2d.corner) .extrude( gliderTabThickness ) .rotateX(90).frontTo(0) val pin = Cylinder.hole( profile.size.y, tab.size.z/2, 10 ) .rotateX(-90) .translateX( tab.left + tab.size.x / 2 ) .translateZ( tab.bottom + tab.size.z / 2 ) return ((main / profile) + tab + pin).color("Orange") } override fun build() : Shape3d { return hook().rotateZ(90).toOrigin() + glide().translateY(12) } }