Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
// 2x8 Lego Brick
|
|
|
|
// A standard Lego brick with 2 bumps wide and 8 bumps long.
|
|
|
|
// Define constants
|
2025-04-30 13:12:40 +12:00
|
|
|
lbumps = 10 // number of bumps long
|
|
|
|
wbumps = {{N}} // number of bumps wide
|
|
|
|
pitch = 8.0
|
|
|
|
clearance = 0.1
|
|
|
|
bumpDiam = 4.8
|
|
|
|
bumpHeight = 1.8
|
|
|
|
height = 9.6
|
|
|
|
t = (pitch - (2 * clearance) - bumpDiam) / 2.0
|
|
|
|
totalLength = lbumps * pitch - (2.0 * clearance)
|
|
|
|
totalWidth = wbumps * pitch - (2.0 * clearance)
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
// Create the plane for the pegs. This is a hack so that the pegs can be patterned along the face of the lego base.
|
2025-04-30 13:12:40 +12:00
|
|
|
pegFace = {
|
|
|
|
origin = { x = 0, y = 0, z = height },
|
|
|
|
xAxis = { x = 1, y = 0, z = 0 },
|
|
|
|
yAxis = { x = 0, y = 1, z = 0 },
|
|
|
|
zAxis = { x = 0, y = 0, z = 1 }
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
}
|
|
|
|
// Create the plane for the tubes underneath the lego. This is a hack so that the tubes can be patterned underneath the lego.
|
2025-04-30 13:12:40 +12:00
|
|
|
tubeFace = {
|
|
|
|
origin = { x = 0, y = 0, z = height - t },
|
|
|
|
xAxis = { x = 1, y = 0, z = 0 },
|
|
|
|
yAxis = { x = 0, y = 1, z = 0 },
|
|
|
|
zAxis = { x = 0, y = 0, z = 1 }
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
}
|
|
|
|
// Make the base
|
2025-05-02 21:07:31 -04:00
|
|
|
s = startSketchOn(XY)
|
2025-04-25 16:01:35 -05:00
|
|
|
|> startProfile(at = [-totalWidth / 2, -totalLength / 2])
|
2025-05-02 21:07:31 -04:00
|
|
|
|> line(end = [totalWidth, 0])
|
|
|
|
|> line(end = [0, totalLength])
|
|
|
|
|> line(end = [-totalWidth, 0])
|
|
|
|
|> close()
|
|
|
|
|> extrude(length = height)
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
|
|
|
|
// Sketch and extrude a rectangular shape to create the shell underneath the lego. This is a hack until we have a shell function.
|
2025-04-30 13:12:40 +12:00
|
|
|
shellExtrude = startSketchOn(s, "start")
|
2025-04-25 16:01:35 -05:00
|
|
|
|> startProfile(at = [
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
-(totalWidth / 2 - t),
|
|
|
|
-(totalLength / 2 - t)
|
2025-04-25 16:01:35 -05:00
|
|
|
])
|
2025-05-02 21:07:31 -04:00
|
|
|
|> line(end = [totalWidth - (2 * t), 0])
|
|
|
|
|> line(end = [0, totalLength - (2 * t)])
|
|
|
|
|> line(end = [-(totalWidth - (2 * t)), 0])
|
|
|
|
|> close()
|
|
|
|
|> extrude(length = -(height - t))
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
|
2025-05-08 14:43:50 -04:00
|
|
|
fn tr(@i) {
|
2025-04-30 13:12:40 +12:00
|
|
|
j = i + 1
|
|
|
|
x = (j/wbumps) * pitch
|
|
|
|
y = (j % wbumps) * pitch
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
return {
|
2025-04-30 13:12:40 +12:00
|
|
|
translate = [x, y, 0],
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the pegs on the top of the base
|
2025-04-30 13:12:40 +12:00
|
|
|
totalBumps = (wbumps * lbumps)-1
|
2025-05-02 21:07:31 -04:00
|
|
|
peg = startSketchOn(s, face = END)
|
2025-02-28 17:40:01 -08:00
|
|
|
|> circle( center = [
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
-(pitch*(wbumps-1)/2),
|
|
|
|
-(pitch*(lbumps-1)/2)
|
2025-02-28 17:40:01 -08:00
|
|
|
], radius = bumpDiam / 2)
|
2025-02-11 16:06:47 -06:00
|
|
|
|> patternLinear2d(
|
|
|
|
axis = [1, 0],
|
|
|
|
instances = wbumps,
|
|
|
|
distance = pitch
|
|
|
|
)
|
|
|
|
|> patternLinear2d(
|
|
|
|
axis = [0, 1],
|
|
|
|
instances = lbumps,
|
|
|
|
distance = pitch
|
|
|
|
)
|
2025-05-02 21:07:31 -04:00
|
|
|
|> extrude(length = bumpHeight)
|
|
|
|
// |> patternTransform(instances = totalBumps-1, transform = tr)
|
Batch extrudes (#3764)
Adds a new KCL executor benchmark which builds a `10` wide by `n` tall lego, with varying `n`. The benchmark runs a n = 1, 2, 3 etc build, so we can get an idea of how the speed changes with size.
This change improves execution speed by 25-36% depending on how many bumps there are. Tested by:
* Rust unit tests
* Open up modeling app, sketch a square, use the command palette to extrude it
* Open up the Bambu printer "poop chute" model, it all extrudes and works fine
Also fixes a bug: extrude, loft, revolve all trigger a GetExtrusionFaceInfo command. Due to a bug, the GetExtrusionFaceInfo command reused the Command ID from the previous extrude/loft/revolve. Fixed that.
2024-09-06 16:55:24 -05:00
|
|
|
|