Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions. Apologies for how large this PR is. Most of it is: - Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`. - Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword. - Update all the artifacts This does _not_ remove support for positional calls. That will be in a follow-up PR.
215 KiB
215 KiB
title, excerpt, layout
title | excerpt | layout |
---|---|---|
std::solid::chamfer | Cut a straight transitional edge along a tagged path. | manual |
Cut a straight transitional edge along a tagged path.
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
chamfer(
@solid: [Solid](/docs/kcl/types/std-types-Solid),
length: number(Length),
tags: [[Edge; 1+]](/docs/kcl/types/std-types-Edge),
tag?: [tag](/docs/kcl/types/std-types-tag),
): [Solid](/docs/kcl/types/std-types-Solid)
Arguments
Name | Type | Description | Required |
---|---|---|---|
solid |
Solid |
The solid whose edges should be chamfered | Yes |
length |
number(Length) |
The length of the chamfer | Yes |
tags |
[Edge; 1+] |
The paths you want to chamfer | Yes |
tag |
tag |
Create a new tag which refers to this chamfer | No |
Returns
Examples
// Chamfer a mounting plate.
width = 20
length = 10
thickness = 1
chamferLength = 2
mountingPlateSketch = startSketchOn(XY)
|> startProfile(at = [-width/2, -length/2])
|> line(endAbsolute = [width/2, -length/2], tag = $edge1)
|> line(endAbsolute = [width/2, length/2], tag = $edge2)
|> line(endAbsolute = [-width/2, length/2], tag = $edge3)
|> close(tag = $edge4)
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|> chamfer(
length = chamferLength,
tags = [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),
getNextAdjacentEdge(edge4)
],
)
// Sketch on the face of a chamfer.
fn cube(pos, scale) {
sg = startSketchOn(XY)
|> startProfile(at = pos)
|> line(end = [0, scale])
|> line(end = [scale, 0])
|> line(end = [0, -scale])
return sg
}
part001 = cube(pos = [0,0], scale = 20)
|> close(tag = $line1)
|> extrude(length = 20)
// We tag the chamfer to reference it later.
|> chamfer(
length = 10,
tags = [getOppositeEdge(line1)],
tag = $chamfer1,
)
sketch001 = startSketchOn(part001, face = chamfer1)
|> startProfile(at = [10, 10])
|> line(end = [2, 0])
|> line(end = [0, 2])
|> line(end = [-2, 0])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 10)