Move axes to std constants; move helix, revolve, and mirror2d to be declated in KCL Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			223 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			223 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
// French Press
 | 
						|
// A french press immersion coffee maker
 | 
						|
 | 
						|
// Set units
 | 
						|
@settings(defaultLengthUnit = in)
 | 
						|
 | 
						|
// Define constants
 | 
						|
carafeDiameter = 4.41
 | 
						|
carafeHeight = 7.32
 | 
						|
handleThickness = 0.65
 | 
						|
 | 
						|
// Upper ring of the metal structure
 | 
						|
sketch001 = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([carafeDiameter / 2, 5.7], %)
 | 
						|
  |> angledLine([0, 0.1], %, $rectangleSegmentA001)
 | 
						|
  |> angledLine([
 | 
						|
       segAng(rectangleSegmentA001) - 90,
 | 
						|
       -0.75
 | 
						|
     ], %, $rectangleSegmentB001)
 | 
						|
  |> angledLine([
 | 
						|
       segAng(rectangleSegmentA001),
 | 
						|
       -segLen(rectangleSegmentA001)
 | 
						|
     ], %, $rectangleSegmentC001)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> revolve(angle = 360, axis = Y)
 | 
						|
 | 
						|
// Create an angled plane to sketch the supports
 | 
						|
plane001 = {
 | 
						|
  plane = {
 | 
						|
    origin = [-0.26, 0.26, 0.0],
 | 
						|
    xAxis = [1, 1, 0.0],
 | 
						|
    yAxis = [0.0, 0.0, 1.0],
 | 
						|
    zAxis = [1.0, 0.0, 0.0]
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
// Cross section of the metal supports
 | 
						|
sketch002 = startSketchOn(plane001)
 | 
						|
  |> startProfileAt([carafeDiameter / 2, 5.7], %)
 | 
						|
  |> xLine(length = 0.1)
 | 
						|
  |> yLine(length = -5.2, tag = $edge1)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 180,
 | 
						|
       angleEnd = 205,
 | 
						|
       radius = 0.3
 | 
						|
     }, %)
 | 
						|
  |> angledLine({ angle = -60, length = 0.6 }, %, $edge2)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 30,
 | 
						|
       angleEnd = -120,
 | 
						|
       radius = 0.6
 | 
						|
     }, %)
 | 
						|
  |> angledLineToY({ angle = 150, to = -0.2 }, %, $edge3)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 60,
 | 
						|
       angleEnd = 90,
 | 
						|
       radius = 0.5
 | 
						|
     }, %)
 | 
						|
  |> xLine(endAbsolute = 0.1, tag = $edgeLen)
 | 
						|
  |> yLine(length = 0.1)
 | 
						|
  |> xLine(length = segLen(edgeLen) + 0.035, tag = $edge4)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 90,
 | 
						|
       angleEnd = 60,
 | 
						|
       radius = 0.6
 | 
						|
     }, %)
 | 
						|
  |> angledLine({
 | 
						|
       angle = 150,
 | 
						|
       length = -segLen(edge3) + 0.035
 | 
						|
     }, %, $edge5)
 | 
						|
  |> arc({
 | 
						|
       angleStart = -120,
 | 
						|
       angleEnd = 30,
 | 
						|
       radius = 0.5
 | 
						|
     }, %)
 | 
						|
  |> angledLine({
 | 
						|
       angle = -60,
 | 
						|
       length = -segLen(edge2) + 0.035
 | 
						|
     }, %, $edge6)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 205,
 | 
						|
       angleEnd = 180,
 | 
						|
       radius = 0.6
 | 
						|
     }, %)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> extrude(length = 0.75)
 | 
						|
  |> patternCircular3d(
 | 
						|
       axis = [0, 0, 1],
 | 
						|
       center = [0, 0, 0],
 | 
						|
       instances = 4,
 | 
						|
       arcDegrees = 360,
 | 
						|
       rotateDuplicates = true,
 | 
						|
     )
 | 
						|
 | 
						|
// Cross plate
 | 
						|
sketch003 = startSketchOn(offsetPlane(XY, offset = 1))
 | 
						|
  |> circle(center = [0, 0], radius = carafeDiameter / 2 - 0.15)
 | 
						|
 | 
						|
extrude001 = extrude(sketch003, length = 0.050)
 | 
						|
 | 
						|
sketch004 = startSketchOn(extrude001, 'END')
 | 
						|
  |> startProfileAt([0.3, 0.17], %)
 | 
						|
  |> yLine(length = 1.2)
 | 
						|
  |> arc({
 | 
						|
       angleStart = 90,
 | 
						|
       angleEnd = -30,
 | 
						|
       radius = 1.2
 | 
						|
     }, %)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> patternCircular2d(
 | 
						|
       center = [0, 0],
 | 
						|
       instances = 3,
 | 
						|
       arcDegrees = 360,
 | 
						|
       rotateDuplicates = true,
 | 
						|
     )
 | 
						|
 | 
						|
extrude002 = extrude(sketch004, length = -0.050)
 | 
						|
 | 
						|
// Filter screen
 | 
						|
sketch005 = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([0.15, 1.11], %)
 | 
						|
  |> xLine(endAbsolute = carafeDiameter / 2 - 0.2)
 | 
						|
  |> angledLineToX({
 | 
						|
       angle = 30,
 | 
						|
       to = carafeDiameter / 2 - 0.07
 | 
						|
     }, %, $seg1)
 | 
						|
  |> angledLine({ angle = -60, length = 0.050 }, %)
 | 
						|
  |> angledLine({ angle = 30, length = -segLen(seg1) }, %)
 | 
						|
  |> xLine(endAbsolute = 0.15)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> revolve(axis = Y)
 | 
						|
 | 
						|
// Plunger and stem
 | 
						|
sketch006 = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([0.1, 1], %)
 | 
						|
  |> line(end = [0.1, 0])
 | 
						|
  |> angledLineToX({ angle = 10, to = 0.05 }, %)
 | 
						|
  |> yLine(length = 10)
 | 
						|
  |> line(end = [0.6, 0])
 | 
						|
  |> yLine(length = -.05)
 | 
						|
  |> tangentialArc({ radius = 0.6, offset = -90 }, %)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> revolve(axis = Y)
 | 
						|
 | 
						|
// Spiral plate
 | 
						|
sketch007 = startSketchOn(offsetPlane(XY, offset = 1.12))
 | 
						|
  |> circle(center = [0, 0], radius = carafeDiameter / 2 - 0.24)
 | 
						|
  |> hole(circle(center = [0, 0], radius = .15), %)
 | 
						|
 | 
						|
extrude003 = extrude(sketch007, length = 0.050)
 | 
						|
 | 
						|
// Pattern holes in the spiral plate
 | 
						|
sketch008 = startSketchOn(extrude003, 'END')
 | 
						|
  |> circle(center = [1.4, 0], radius = .3)
 | 
						|
  |> patternCircular2d(
 | 
						|
       center = [0, 0],
 | 
						|
       instances = 8,
 | 
						|
       arcDegrees = 360,
 | 
						|
       rotateDuplicates = true,
 | 
						|
     )
 | 
						|
 | 
						|
extrude004 = extrude(sketch008, length = -0.050)
 | 
						|
 | 
						|
// Pattern holes in the spiral plate
 | 
						|
sketch009 = startSketchOn(extrude003, 'END')
 | 
						|
  |> circle(center = [0.6, 0], radius = .2)
 | 
						|
  |> patternCircular2d(
 | 
						|
       center = [0, 0],
 | 
						|
       instances = 4,
 | 
						|
       arcDegrees = 360,
 | 
						|
       rotateDuplicates = true,
 | 
						|
     )
 | 
						|
 | 
						|
extrude005 = extrude(sketch009, length = -0.050)
 | 
						|
 | 
						|
// Extrude a glass carafe body
 | 
						|
sketch010 = startSketchOn(XY)
 | 
						|
  |> circle(center = [0, 0], radius = carafeDiameter / 2)
 | 
						|
 | 
						|
// Perform a shell operation to hollow the carafe body with the top face removed
 | 
						|
extrude006 = extrude(sketch010, length = carafeHeight)
 | 
						|
  |> shell(faces = ["end"], thickness = .07)
 | 
						|
 | 
						|
// Draw and revolve the lid
 | 
						|
sketch011 = startSketchOn(XZ)
 | 
						|
  |> startProfileAt([0.2, carafeHeight - 0.7], %)
 | 
						|
  |> xLine(length = carafeDiameter / 2 - 0.3)
 | 
						|
  |> yLine(length = 0.7)
 | 
						|
  |> xLine(length = 0.3)
 | 
						|
  |> yLine(length = 0.4)
 | 
						|
  |> line(end = [-0.02, 0.02])
 | 
						|
  |> bezierCurve({
 | 
						|
       to = [-carafeDiameter / 2 - 0.1, 1],
 | 
						|
       control1 = [-0.3, 0],
 | 
						|
       control2 = [carafeDiameter / 10, 1]
 | 
						|
     }, %)
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
  |> revolve(axis = Y)
 | 
						|
 | 
						|
// Draw and extrude handle
 | 
						|
sketch012 = startSketchOn(offsetPlane(XZ, offset = handleThickness / 2))
 | 
						|
  |> startProfileAt([2.3, 6.4], %)
 | 
						|
  |> line(end = [0.56, 0])
 | 
						|
  |> tangentialArcTo([4.1, 5.26], %)
 | 
						|
  |> tangentialArcTo([4.17, 1.6], %)
 | 
						|
  |> tangentialArcTo([3.13, 0.61], %)
 | 
						|
  |> line(end = [-1.09, 0])
 | 
						|
  |> line(end = [0, 0.43])
 | 
						|
  |> line(end = [0.99, -0.02])
 | 
						|
  |> tangentialArcTo([3.63, 1.6], %)
 | 
						|
  |> tangentialArcTo([3.56, 5.15], %)
 | 
						|
  |> tangentialArcTo([2.72, 5.88], %)
 | 
						|
  |> line(end = [-0.4, 0])
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
extrude007 = extrude(sketch012, length = -handleThickness)
 |