Skip to content

test to repro fillet failed error #6719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions rust/kcl-lib/e2e/executor/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,3 +615,36 @@ extrude(profile001, length = 100)"#
assert!(first.1 != last.1, "The images should be different for the grid");
assert_eq!(first.2, last.2, "The outcomes should be the same");
}

#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_cache_fillet_error_opening_closing_specific_files() {
let main_code = include_str!("../../tests/fillet_error_switch_files/main.kcl");
let switch_code = include_str!("../../tests/fillet_error_switch_files/switch_protector.kcl");

let result = cache_test(
"fillet_error_opening_closing_specific_files",
vec![
Variation {
code: main_code,
other_files: Vec::new(),
settings: &Default::default(),
},
Variation {
code: switch_code,
other_files: Vec::new(),
settings: &Default::default(),
},
Variation {
code: main_code,
other_files: Vec::new(),
settings: &Default::default(),
},
],
)
.await;

// Make sure nothing failed.
result.first().unwrap();
result.get(1).unwrap();
result.last().unwrap();
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions rust/kcl-lib/src/execution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,10 @@ impl ExecutorContext {
.await;

let outcome = exec_state.to_exec_outcome(result.0).await;

println!("batch_end: {:#?}", self.engine.batch_end().read().await);
println!("responses: {:#?}", self.engine.responses().read().await);
println!("batch: {:#?}", self.engine.batch().read().await);
Ok(outcome)
}

Expand Down
70 changes: 70 additions & 0 deletions rust/kcl-lib/tests/fillet_error_switch_files/main.kcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
holeFudge = 0.4
frontBarD = 5.0
yBarD = 6.7
slideGap = 0.7
lowerBlockTransHole = {
r = (frontBarD + slideGap + holeFudge) / 2
}
upperBlockLongHole = { r = (yBarD + holeFudge) / 2 }

upperBlockTransHole = { r = (yBarD + holeFudge) / 2 }
tubeClr = 1.5
lowerBlock = {
h = 2 * lowerBlockTransHole.r + 2 * tubeClr,
l = 70
}
upperBlock = {
h = 2 * upperBlockLongHole.r + 2 * tubeClr,
l = 25
}
elevate = { h = 5 }

blockSz = max([upperBlock.h, lowerBlock.h])

slot = { l = 10, h = 1 }

sketch001 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
|> yLine(length = blockSz, tag = $edgeA)
|> xLine(length = blockSz, tag = $edgeB)
|> yLine(length = -blockSz, tag = $edgeC)
|> xLine(length = upperBlock.l - blockSz, tag = $edge1)
|> yLine(length = -(elevate.h + blockSz), tag = $edge2)
|> xLine(length = lowerBlock.l - blockSz, tag = $edge3)
|> yLine(length = -blockSz, tag = $edge4)
|> xLine(length = -lowerBlock.l, tag = $edge5)
|> yLine(length = blockSz + elevate.h, tag = $edge6)
|> xLine(length = -(upperBlock.l - blockSz), tag = $edge7)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
|> close()
|> subtract2d(tool = circle(center = [blockSz / 2, blockSz / 2], radius = upperBlockTransHole.r))
|> subtract2d(tool = circle(
center = [
upperBlock.l + lowerBlock.l - blockSz - lowerBlockTransHole.r - tubeClr,
-(blockSz + elevate.h + blockSz / 2)
],
radius = lowerBlockTransHole.r,
))
rad = 3

extrude001 = extrude(sketch001, length = blockSz)
|> fillet(
radius = rad,
tags = [
getNextAdjacentEdge(edgeA),
getNextAdjacentEdge(edgeB),
getNextAdjacentEdge(edgeC),
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),
getNextAdjacentEdge(edge4),
getNextAdjacentEdge(edge5),
getNextAdjacentEdge(edge6),
getNextAdjacentEdge(edge7)
],
)

sketch002 = startSketchOn(extrude001, face = seg01)
|> startProfile(at = [0, 0])
|> circle(center = [blockSz / 2, -blockSz / 2], radius = upperBlockLongHole.r)
|> extrude(length = -upperBlock.l)
22 changes: 22 additions & 0 deletions rust/kcl-lib/tests/fillet_error_switch_files/switch_protector.kcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
holeFudgeD = 0.4
holeFudgeR = holeFudgeD / 2

totalH = 12.5
switchNutD = 9.5
switchNutR = switchNutD / 2
bottomInnerR = switchNutR + holeFudgeR
bottomOuterR = 13.5
topInnerR = switchNutR + 1.5 + holeFudgeR
topFlatL = 1
topOuterR = topInnerR + topFlatL
baseH = 1
coneH = totalH - baseH

sketch001 = startSketchOn(XZ)
|> startProfile(at = [bottomInnerR, 0])
|> xLine(endAbsolute = bottomOuterR)
|> yLine(length = baseH)
|> line(end = [-(bottomOuterR - topOuterR), coneH])
|> line(end = [-(topOuterR - topInnerR), 0])
|> close()
|> revolve(axis = Y)
Loading