kcl-std → functions → chamfer

chamferFunction in std::solid

Cut a straight transitional edge along a tagged path.

chamfer(
  @solid: Solid,
  length: number(Length),
  tags: [Edge; 1+],
  secondLength?: number(Length),
  angle?: number(Angle),
  tag?: TagDecl,
): Solid

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.

Arguments

NameTypeDescriptionRequired
solidSolidThe solid whose edges should be chamferedYes
lengthnumber(Length)Chamfering cuts away two faces to create a third face. This is the length to chamfer away from each face. The larger this length to chamfer away, the larger the new face will be.Yes
tags[Edge; 1+]The paths you want to chamferYes
secondLengthnumber(Length)Chamfering cuts away two faces to create a third face. If this argument isn't given, the lengths chamfered away from both the first and second face are both given by length. If this argument is given, it determines how much is cut away from the second face. Incompatible with angle.No
anglenumber(Angle)Chamfering cuts away two faces to create a third face. This argument determines the angle between the two cut edges. Requires length, incompatible with secondLength. The valid range is 0deg < angle < 90deg.No
tagTagDeclCreate a new tag which refers to this chamferNo

Returns

Solid - A solid is a collection of extruded surfaces.

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)

// Specify a custom chamfer angle.
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)
  |> chamfer(length = 10, angle = 30deg, tags = [getOppositeEdge(line1)])

Found a typo?