rename radius to length for chamfer; (#2702)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-06-18 18:33:57 -07:00
committed by GitHub
parent c61273085f
commit e2a835a437
3 changed files with 13 additions and 13 deletions

View File

@ -18,7 +18,7 @@ chamfer(data: ChamferData, extrude_group: ExtrudeGroup) -> ExtrudeGroup
const width = 20 const width = 20
const length = 10 const length = 10
const thickness = 1 const thickness = 1
const chamferRadius = 2 const chamferLength = 2
const mountingPlateSketch = startSketchOn("XY") const mountingPlateSketch = startSketchOn("XY")
|> startProfileAt([-width / 2, -length / 2], %) |> startProfileAt([-width / 2, -length / 2], %)
@ -29,7 +29,7 @@ const mountingPlateSketch = startSketchOn("XY")
const mountingPlate = extrude(thickness, mountingPlateSketch) const mountingPlate = extrude(thickness, mountingPlateSketch)
|> chamfer({ |> chamfer({
radius: chamferRadius, length: chamferLength,
tags: [ tags: [
getNextAdjacentEdge('edge1', %), getNextAdjacentEdge('edge1', %),
getNextAdjacentEdge('edge2', %), getNextAdjacentEdge('edge2', %),
@ -46,8 +46,8 @@ const mountingPlate = extrude(thickness, mountingPlateSketch)
* `data`: `ChamferData` - Data for chamfers. (REQUIRED) * `data`: `ChamferData` - Data for chamfers. (REQUIRED)
```js ```js
{ {
// The radius of the chamfer. // The length of the chamfer.
radius: number, length: number,
// The tags of the paths you want to chamfer. // The tags of the paths you want to chamfer.
tags: [uuid | tags: [uuid |
string], string],

View File

@ -18155,12 +18155,12 @@
"description": "Data for chamfers.", "description": "Data for chamfers.",
"type": "object", "type": "object",
"required": [ "required": [
"radius", "length",
"tags" "tags"
], ],
"properties": { "properties": {
"radius": { "length": {
"description": "The radius of the chamfer.", "description": "The length of the chamfer.",
"type": "number", "type": "number",
"format": "double" "format": "double"
}, },
@ -19702,7 +19702,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"const width = 20\nconst length = 10\nconst thickness = 1\nconst chamferRadius = 2\n\nconst mountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, 'edge1')\n |> lineTo([width / 2, length / 2], %, 'edge2')\n |> lineTo([-width / 2, length / 2], %, 'edge3')\n |> close(%, 'edge4')\n\nconst mountingPlate = extrude(thickness, mountingPlateSketch)\n |> chamfer({\n radius: chamferRadius,\n tags: [\n getNextAdjacentEdge('edge1', %),\n getNextAdjacentEdge('edge2', %),\n getNextAdjacentEdge('edge3', %),\n getNextAdjacentEdge('edge4', %)\n ]\n }, %)" "const width = 20\nconst length = 10\nconst thickness = 1\nconst chamferLength = 2\n\nconst mountingPlateSketch = startSketchOn(\"XY\")\n |> startProfileAt([-width / 2, -length / 2], %)\n |> lineTo([width / 2, -length / 2], %, 'edge1')\n |> lineTo([width / 2, length / 2], %, 'edge2')\n |> lineTo([-width / 2, length / 2], %, 'edge3')\n |> close(%, 'edge4')\n\nconst mountingPlate = extrude(thickness, mountingPlateSketch)\n |> chamfer({\n length: chamferLength,\n tags: [\n getNextAdjacentEdge('edge1', %),\n getNextAdjacentEdge('edge2', %),\n getNextAdjacentEdge('edge3', %),\n getNextAdjacentEdge('edge4', %)\n ]\n }, %)"
] ]
}, },
{ {

View File

@ -19,8 +19,8 @@ pub(crate) const DEFAULT_TOLERANCE: f64 = 0.0000001;
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ChamferData { pub struct ChamferData {
/// The radius of the chamfer. /// The length of the chamfer.
pub radius: f64, pub length: f64,
/// The tags of the paths you want to chamfer. /// The tags of the paths you want to chamfer.
pub tags: Vec<EdgeReference>, pub tags: Vec<EdgeReference>,
} }
@ -50,7 +50,7 @@ pub async fn chamfer(args: Args) -> Result<MemoryItem, KclError> {
/// const width = 20 /// const width = 20
/// const length = 10 /// const length = 10
/// const thickness = 1 /// const thickness = 1
/// const chamferRadius = 2 /// const chamferLength = 2
/// ///
/// const mountingPlateSketch = startSketchOn("XY") /// const mountingPlateSketch = startSketchOn("XY")
/// |> startProfileAt([-width/2, -length/2], %) /// |> startProfileAt([-width/2, -length/2], %)
@ -61,7 +61,7 @@ pub async fn chamfer(args: Args) -> Result<MemoryItem, KclError> {
/// ///
/// const mountingPlate = extrude(thickness, mountingPlateSketch) /// const mountingPlate = extrude(thickness, mountingPlateSketch)
/// |> chamfer({ /// |> chamfer({
/// radius: chamferRadius, /// length: chamferLength,
/// tags: [ /// tags: [
/// getNextAdjacentEdge('edge1', %), /// getNextAdjacentEdge('edge1', %),
/// getNextAdjacentEdge('edge2', %), /// getNextAdjacentEdge('edge2', %),
@ -114,7 +114,7 @@ async fn inner_chamfer(
ModelingCmd::Solid3DFilletEdge { ModelingCmd::Solid3DFilletEdge {
edge_id, edge_id,
object_id: extrude_group.id, object_id: extrude_group.id,
radius: data.radius, radius: data.length,
tolerance: DEFAULT_TOLERANCE, // We can let the user set this in the future. tolerance: DEFAULT_TOLERANCE, // We can let the user set this in the future.
cut_type: Some(kittycad::types::CutType::Chamfer), cut_type: Some(kittycad::types::CutType::Chamfer),
}, },