KCL: Add planeOf function to stdlib (#7643)

Gets the plane a face lies on, if any.

Closes #7642
This commit is contained in:
Adam Chalmers
2025-07-01 12:42:12 -05:00
committed by GitHub
parent 4a080d1583
commit fbcbb341e2
29 changed files with 1945 additions and 44 deletions

View File

@ -1941,3 +1941,24 @@ export fn subtract2d(
/// The shape(s) which should be cut out of the sketch.
tool: [Sketch; 1+],
): Sketch {}
/// Find the plane a face lies on.
/// Returns an error if the face doesn't lie on any plane (for example, the curved face of a cylinder)
///```kcl
/// triangle = startSketchOn(XY)
/// |> polygon(radius = 3, numSides = 3, center = [0, 0])
/// |> extrude(length = 2)
///
/// // Find the plane of the triangle's top face.
/// topPlane = planeOf(triangle, face = END)
///
/// // Create a new plane, 10 units above the triangle's top face.
/// startSketchOn(offsetPlane(topPlane, offset = 10))
/// ```
@(impl = std_rust)
export fn planeOf(
/// The solid whose face is being queried.
@solid: Solid,
/// Find the plane which this face lies on.
face: TaggedFace,
): Plane {}