Add support for tag on close segment when the last sketch edge is missing (#7375)

* add test

* fix

* Update snapshots

* Update snapshots

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
max
2025-06-06 03:30:24 +02:00
committed by GitHub
parent 0bce7d3c1c
commit de6184c622
4 changed files with 34 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -514,6 +514,36 @@ extrude001 = extrude(sketch001, length = -15, tagEnd = $capEnd001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = -15, tagEnd = $capEnd001)
|> ${edgeTreatmentType}(
${parameterName} = 3,
tags = [
getCommonEdge(faces = [seg01, capEnd001])
],
)`
await runModifyAstCloneWithEdgeTreatmentAndTag(
code,
segmentSnippets,
parameters,
expectedCode
)
}, 10_000)
it(`should add a ${edgeTreatmentType} to "close" if last segment is missing`, async () => {
const code = `sketch001 = startSketchOn(XY)
|> startProfile(at = [-10, 10])
|> line(end = [20, 0])
|> line(end = [0, -20])
|> line(end = [-20, 0])
|> close()
|> extrude(length = -15)`
const segmentSnippets = ['close()']
const expectedCode = `sketch001 = startSketchOn(XY)
|> startProfile(at = [-10, 10])
|> line(end = [20, 0])
|> line(end = [0, -20])
|> line(end = [-20, 0])
|> close(tag = $seg01)
|> extrude(length = -15, tagEnd = $capEnd001)
|> ${edgeTreatmentType}(
${parameterName} = 3,
tags = [

View File

@ -533,7 +533,10 @@ function modifyAstWithTagForSketchSegment(
if (err(segmentNode)) return segmentNode
// Check whether selection is a valid sketch segment
if (!(segmentNode.node.callee.name.name in sketchLineHelperMapKw)) {
if (
!(segmentNode.node.callee.name.name in sketchLineHelperMapKw) &&
segmentNode.node.callee.name.name !== 'close'
) {
return new Error('Selection is not a sketch segment')
}