make pipe have a hole (#4766)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -34804,7 +34804,7 @@
|
||||
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 2], %)\n |> line([3, 1], %)\n |> line([0, -4], %)\n |> close(%)\n\nexample = extrude(1, exampleSketch)\n |> appearance({\n color = '#ff0000',\n metalness = 90,\n roughness = 90\n }, %)\n |> patternLinear3d({\n axis = [1, 0, 1],\n instances = 7,\n distance = 6\n }, %)",
|
||||
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _after_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line([0, 2], %)\n |> line([3, 1], %)\n |> line([0, -4], %)\n |> close(%)\n\nexample = extrude(1, exampleSketch)\n |> patternLinear3d({\n axis = [1, 0, 1],\n instances = 7,\n distance = 6\n }, %)\n |> appearance({\n color = '#ff0000',\n metalness = 90,\n roughness = 90\n }, %)",
|
||||
"// Color the result of a 2D pattern that was extruded.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line([0, 5], %)\n |> line([-1, 0], %)\n |> line([0, -5], %)\n |> close(%)\n |> patternCircular2d({\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true\n }, %)\n\nexample = extrude(1, exampleSketch)\n |> appearance({\n color = '#ff0000',\n metalness = 90,\n roughness = 90\n }, %)",
|
||||
"// Color the result of a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line([0, 7], %)\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line([-3, 0], %)\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line([0, 7], %)\n\nsweepSketch = startSketchOn('XY')\n |> startProfileAt([2, 0], %)\n |> arc({\n angleEnd = 360,\n angleStart = 0,\n radius = 2\n }, %)\n |> sweep({ path = sweepPath }, %)\n |> appearance({\n color = \"#ff0000\",\n metalness = 50,\n roughness = 50\n }, %)"
|
||||
"// Color the result of a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line([0, 7], %)\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line([-3, 0], %)\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line([0, 7], %)\n\npipeHole = startSketchOn('XY')\n |> circle({ center = [0, 0], radius = 1.5 }, %)\n\nsweepSketch = startSketchOn('XY')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> hole(pipeHole, %)\n |> sweep({ path = sweepPath }, %)\n |> appearance({\n color = \"#ff0000\",\n metalness = 50,\n roughness = 50\n }, %)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -178348,7 +178348,7 @@
|
||||
"unpublished": false,
|
||||
"deprecated": false,
|
||||
"examples": [
|
||||
"// Create a pipe using a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line([0, 7], %)\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line([-3, 0], %)\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line([0, 7], %)\n\nsweepSketch = startSketchOn('XY')\n |> startProfileAt([2, 0], %)\n |> arc({\n angleEnd = 360,\n angleStart = 0,\n radius = 2\n }, %)\n |> sweep({ path = sweepPath }, %)"
|
||||
"// Create a pipe using a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line([0, 7], %)\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line([-3, 0], %)\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line([0, 7], %)\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle({ center = [0, 0], radius = 1.5 }, %)\n\nsweepSketch = startSketchOn('XY')\n |> circle({ center = [0, 0], radius = 2 }, %)\n |> hole(pipeHole, %)\n |> sweep({ path = sweepPath }, %)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
@ -236,6 +236,8 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
fn to_autocomplete_snippet(&self) -> Result<String> {
|
||||
if self.name() == "loft" {
|
||||
return Ok("loft([${0:sketch000}, ${1:sketch001}])${}".to_string());
|
||||
} else if self.name() == "hole" {
|
||||
return Ok("hole(${0:holeSketch}, ${1:%})${}".to_string());
|
||||
}
|
||||
let mut args = Vec::new();
|
||||
let mut index = 0;
|
||||
@ -1001,6 +1003,13 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_autocomplete_snippet_hole() {
|
||||
let hole_fn: Box<dyn StdLibFn> = Box::new(crate::std::sketch::Hole);
|
||||
let snippet = hole_fn.to_autocomplete_snippet().unwrap();
|
||||
assert_eq!(snippet, r#"hole(${0:holeSketch}, ${1:%})${}"#);
|
||||
}
|
||||
|
||||
// We want to test the snippets we compile at lsp start.
|
||||
#[test]
|
||||
fn get_all_stdlib_autocomplete_snippets() {
|
||||
|
@ -240,13 +240,18 @@ pub async fn appearance(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
/// }, %)
|
||||
/// |> line([0, 7], %)
|
||||
///
|
||||
/// sweepSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([2, 0], %)
|
||||
/// |> arc({
|
||||
/// angleEnd: 360,
|
||||
/// angleStart: 0,
|
||||
/// radius: 2
|
||||
/// pipeHole = startSketchOn('XY')
|
||||
/// |> circle({
|
||||
/// center = [0, 0],
|
||||
/// radius = 1.5,
|
||||
/// }, %)
|
||||
///
|
||||
/// sweepSketch = startSketchOn('XY')
|
||||
/// |> circle({
|
||||
/// center = [0, 0],
|
||||
/// radius = 2,
|
||||
/// }, %)
|
||||
/// |> hole(pipeHole, %)
|
||||
/// |> sweep({
|
||||
/// path: sweepPath,
|
||||
/// }, %)
|
||||
|
@ -60,13 +60,19 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
/// }, %)
|
||||
/// |> line([0, 7], %)
|
||||
///
|
||||
/// sweepSketch = startSketchOn('XY')
|
||||
/// |> startProfileAt([2, 0], %)
|
||||
/// |> arc({
|
||||
/// angleEnd: 360,
|
||||
/// angleStart: 0,
|
||||
/// radius: 2
|
||||
/// // Create a hole for the pipe.
|
||||
/// pipeHole = startSketchOn('XY')
|
||||
/// |> circle({
|
||||
/// center = [0, 0],
|
||||
/// radius = 1.5,
|
||||
/// }, %)
|
||||
///
|
||||
/// sweepSketch = startSketchOn('XY')
|
||||
/// |> circle({
|
||||
/// center = [0, 0],
|
||||
/// radius = 2,
|
||||
/// }, %)
|
||||
/// |> hole(pipeHole, %)
|
||||
/// |> sweep({
|
||||
/// path: sweepPath,
|
||||
/// }, %)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 74 KiB |
Binary file not shown.
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 73 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 35 KiB |
Reference in New Issue
Block a user