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:
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 |
@ -514,6 +514,36 @@ extrude001 = extrude(sketch001, length = -15, tagEnd = $capEnd001)
|
|||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = -15, tagEnd = $capEnd001)
|
|> 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}(
|
|> ${edgeTreatmentType}(
|
||||||
${parameterName} = 3,
|
${parameterName} = 3,
|
||||||
tags = [
|
tags = [
|
||||||
|
@ -533,7 +533,10 @@ function modifyAstWithTagForSketchSegment(
|
|||||||
if (err(segmentNode)) return segmentNode
|
if (err(segmentNode)) return segmentNode
|
||||||
|
|
||||||
// Check whether selection is a valid sketch segment
|
// 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')
|
return new Error('Selection is not a sketch segment')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user