KCL: Global rotation is fixed (#4017)
Also, there were some executor unit tests to test pattern transform. I realized they make more sense as example tests in the KCL stdlib for pattern transform. This way, they show up in the docs too. So I removed the unit tests (the examples now test these features instead). Big thanks to Serena for fixing this on the engine side! Also looks like the pictures from artifact graph were deleted, so GH Actions wants to put it back.
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -210868,6 +210868,7 @@
 | 
			
		||||
      "// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n  return { translate: [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nconst sketch001 = startSketchOn('XZ')\n  |> circle({ center: [0, 0], radius: 2 }, %)\n  |> extrude(5, %)\n  |> patternTransform(4, transform, %)",
 | 
			
		||||
      "// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform = (id) => {\n  return { translate: [4 * (1 + id), 0, 0] }\n}\n\nconst sketch001 = startSketchOn('XZ')\n  |> circle({ center: [0, 0], radius: 2 }, %)\n  |> extrude(5, %)\n  |> patternTransform(4, transform, %)",
 | 
			
		||||
      "fn cube = (length, center) => {\n  let l = length / 2\n  let x = center[0]\n  let y = center[1]\n  let p0 = [-l + x, -l + y]\n  let p1 = [-l + x, l + y]\n  let p2 = [l + x, l + y]\n  let p3 = [l + x, -l + y]\n\n  return startSketchAt(p0)\n  |> lineTo(p1, %)\n  |> lineTo(p2, %)\n  |> lineTo(p3, %)\n  |> lineTo(p0, %)\n  |> close(%)\n  |> extrude(length, %)\n}\n\nlet width = 20\nfn transform = (i) => {\n  return {\n  // Move down each time.\n  translate: [0, 0, -i * width],\n  // Make the cube longer, wider and flatter each time.\n  scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)],\n  // Turn by 15 degrees each time.\n  rotation: { angle: 15 * i, origin: \"local\" }\n}\n}\n\nlet myCubes = cube(width, [100, 0])\n  |> patternTransform(25, transform, %)",
 | 
			
		||||
      "fn cube = (length, center) => {\n  let l = length / 2\n  let x = center[0]\n  let y = center[1]\n  let p0 = [-l + x, -l + y]\n  let p1 = [-l + x, l + y]\n  let p2 = [l + x, l + y]\n  let p3 = [l + x, -l + y]\n\n  return startSketchAt(p0)\n  |> lineTo(p1, %)\n  |> lineTo(p2, %)\n  |> lineTo(p3, %)\n  |> lineTo(p0, %)\n  |> close(%)\n  |> extrude(length, %)\n}\n\nlet width = 20\nfn transform = (i) => {\n  return {\n  translate: [0, 0, -i * width],\n  rotation: {\n    angle: 90 * i,\n    // Rotate around the overall scene's origin.\n    origin: \"global\"\n  }\n}\n}\nlet myCubes = cube(width, [100, 100])\n  |> patternTransform(4, transform, %)",
 | 
			
		||||
      "// Parameters\nconst r = 50 // base radius\nconst h = 10 // layer height\nconst t = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform = (replicaId) => {\n  let scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))\n  return {\n  translate: [0, 0, replicaId * 10],\n  scale: [scale, scale, 0]\n}\n}\n// Each layer is just a pretty thin cylinder.\nfn layer = () => {\n  return startSketchOn(\"XY\")\n  // or some other plane idk\n  |> circle({ center: [0, 0], radius: 1 }, %, $tag1)\n  |> extrude(h, %)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nlet vase = layer()\n  |> patternTransform(100, transform, %)"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user