* Make `=` and `=>` optional in function declarations And requires `:` for return types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Tests Signed-off-by: Nick Cameron <nrc@ncameron.org> * Format types in function decls Signed-off-by: Nick Cameron <nrc@ncameron.org> * Require in anon function decls Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
		
			
				
	
	
		
			92 lines
		
	
	
		
			215 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			92 lines
		
	
	
		
			215 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: "chamfer"
 | 
						|
excerpt: "Cut a straight transitional edge along a tagged path."
 | 
						|
layout: 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.
 | 
						|
 | 
						|
```js
 | 
						|
chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid
 | 
						|
```
 | 
						|
 | 
						|
 | 
						|
### Arguments
 | 
						|
 | 
						|
| Name | Type | Description | Required |
 | 
						|
|----------|------|-------------|----------|
 | 
						|
| `data` | [`ChamferData`](/docs/kcl/types/ChamferData) | Data for chamfers. | Yes |
 | 
						|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
 | 
						|
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) |  | No |
 | 
						|
 | 
						|
### Returns
 | 
						|
 | 
						|
[`Solid`](/docs/kcl/types/Solid) - An solid is a collection of extrude surfaces.
 | 
						|
 | 
						|
 | 
						|
### Examples
 | 
						|
 | 
						|
```js
 | 
						|
// Chamfer a mounting plate.
 | 
						|
width = 20
 | 
						|
length = 10
 | 
						|
thickness = 1
 | 
						|
chamferLength = 2
 | 
						|
 | 
						|
mountingPlateSketch = startSketchOn("XY")
 | 
						|
  |> startProfileAt([-width / 2, -length / 2], %)
 | 
						|
  |> lineTo([width / 2, -length / 2], %, $edge1)
 | 
						|
  |> lineTo([width / 2, length / 2], %, $edge2)
 | 
						|
  |> lineTo([-width / 2, length / 2], %, $edge3)
 | 
						|
  |> close(%, $edge4)
 | 
						|
 | 
						|
mountingPlate = extrude(thickness, mountingPlateSketch)
 | 
						|
  |> chamfer({
 | 
						|
       length = chamferLength,
 | 
						|
       tags = [
 | 
						|
         getNextAdjacentEdge(edge1),
 | 
						|
         getNextAdjacentEdge(edge2),
 | 
						|
         getNextAdjacentEdge(edge3),
 | 
						|
         getNextAdjacentEdge(edge4)
 | 
						|
       ]
 | 
						|
     }, %)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// Sketch on the face of a chamfer.
 | 
						|
fn cube(pos, scale) {
 | 
						|
  sg = startSketchOn('XY')
 | 
						|
    |> startProfileAt(pos, %)
 | 
						|
    |> line([0, scale], %)
 | 
						|
    |> line([scale, 0], %)
 | 
						|
    |> line([0, -scale], %)
 | 
						|
 | 
						|
  return sg
 | 
						|
}
 | 
						|
 | 
						|
part001 = cube([0, 0], 20)
 | 
						|
  |> close(%, $line1)
 | 
						|
  |> extrude(20, %)
 | 
						|
  |> chamfer({
 | 
						|
       length = 10,
 | 
						|
       tags = [getOppositeEdge(line1)]
 | 
						|
     }, %, $chamfer1) // We tag the chamfer to reference it later.
 | 
						|
 | 
						|
sketch001 = startSketchOn(part001, chamfer1)
 | 
						|
  |> startProfileAt([10, 10], %)
 | 
						|
  |> line([2, 0], %)
 | 
						|
  |> line([0, 2], %)
 | 
						|
  |> line([-2, 0], %)
 | 
						|
  |> lineTo([profileStartX(%), profileStartY(%)], %)
 | 
						|
  |> close(%)
 | 
						|
  |> extrude(10, %)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
 |