61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								source: kcl-lib/src/simulation_tests.rs
							 | 
						||
| 
								 | 
							
								description: Result of unparsing panic_repro_cube.kcl
							 | 
						||
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								/* Generated by Text-to-CAD:
							 | 
						||
| 
								 | 
							
								Create a cube with sides of length 20mm.  On the top face, add a cylindrical boss of radius 6mm and height 2mm. Then, shell the body to 2mm thickness, leaving the top face of the cylindrical boss open. */
							 | 
						||
| 
								 | 
							
								@settings(defaultLengthUnit = mm)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Define the dimensions of the cube
							 | 
						||
| 
								 | 
							
								cubeSide = 20
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Define the dimensions of the cylindrical boss
							 | 
						||
| 
								 | 
							
								bossRadius = 6
							 | 
						||
| 
								 | 
							
								bossHeight = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Define the shell thickness
							 | 
						||
| 
								 | 
							
								shellThickness = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Define the fillet radius
							 | 
						||
| 
								 | 
							
								filletRadius = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Create a sketch for the cube
							 | 
						||
| 
								 | 
							
								cubeSketch = startSketchOn(XY)
							 | 
						||
| 
								 | 
							
								  |> startProfile(at = [-cubeSide / 2, -cubeSide / 2])
							 | 
						||
| 
								 | 
							
								  |> xLine(length = cubeSide)
							 | 
						||
| 
								 | 
							
								  |> yLine(length = cubeSide, tag = $seg01)
							 | 
						||
| 
								 | 
							
								  |> xLine(length = -cubeSide)
							 | 
						||
| 
								 | 
							
								  |> yLine(length = -cubeSide, tag = $seg02)
							 | 
						||
| 
								 | 
							
								  |> close()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Extrude the cube
							 | 
						||
| 
								 | 
							
								cube = extrude(
							 | 
						||
| 
								 | 
							
								  cubeSketch,
							 | 
						||
| 
								 | 
							
								  length = cubeSide,
							 | 
						||
| 
								 | 
							
								  tagEnd = $topFace,
							 | 
						||
| 
								 | 
							
								  tagStart = $capStart001,
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Apply fillets to all edges of the cube
							 | 
						||
| 
								 | 
							
								filletedCube = fillet(
							 | 
						||
| 
								 | 
							
								  cube,
							 | 
						||
| 
								 | 
							
								  radius = filletRadius,
							 | 
						||
| 
								 | 
							
								  tags = [
							 | 
						||
| 
								 | 
							
								    getNextAdjacentEdge(seg01),
							 | 
						||
| 
								 | 
							
								    getNextAdjacentEdge(seg02),
							 | 
						||
| 
								 | 
							
								    // these double wrapped functions are the point of this test
							 | 
						||
| 
								 | 
							
								    getNextAdjacentEdge(getNextAdjacentEdge(seg01)),
							 | 
						||
| 
								 | 
							
								    getNextAdjacentEdge(getNextAdjacentEdge(seg02))
							 | 
						||
| 
								 | 
							
								  ],
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Create a sketch for the cylindrical boss on the top face of the cube
							 | 
						||
| 
								 | 
							
								bossSketch = startSketchOn(filletedCube, face = topFace)
							 | 
						||
| 
								 | 
							
								  |> circle(center = [0, 0], radius = bossRadius)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Extrude the cylindrical boss
							 | 
						||
| 
								 | 
							
								boss = extrude(bossSketch, length = bossHeight, tagEnd = $bossTopFace)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Shell the cube, leaving the top face of the cylindrical boss open
							 | 
						||
| 
								 | 
							
								shell([filletedCube, boss], thickness = shellThickness, faces = [bossTopFace])
							 |