Skip to content

Conversation

@pierremtb
Copy link
Contributor

@pierremtb pierremtb commented Jan 7, 2026

Closes #9581

Adds the optional arg to the command palette config just like for Extrude at #9354. Cleans up a bit so we're ready to add this to more places.

A few notes at #9572 (review)

@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
modeling-app Ready Ready Preview, Comment Jan 8, 2026 7:05pm

@pierremtb pierremtb marked this pull request as ready for review January 8, 2026 13:52
@pierremtb pierremtb requested a review from a team as a code owner January 8, 2026 13:52
@pierremtb pierremtb requested a review from max-mrgrsk January 8, 2026 13:53
@pierremtb pierremtb changed the title ZDS support for Revolve Surface Add bodyType to Revolve Jan 8, 2026
@pierremtb pierremtb changed the title Add bodyType to Revolve Add bodyType to Revolve P&C Jan 8, 2026
Copy link
Contributor Author

@pierremtb pierremtb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review

Comment on lines +836 to +870
it('should add basic revolve call with surface bodyType', async () => {
const { ast, sketches } = await getAstAndSketchSelections(
circleCode,
instanceInThisFile,
kclManagerInThisFile
)
expect(sketches.graphSelections).toHaveLength(1)
const angle = await getKclCommandValue(
'10',
instanceInThisFile,
rustContextInThisFile
)
const axis = 'X'
const result = addRevolve({
ast,
sketches,
angle,
axis,
bodyType: 'SURFACE',
wasmInstance: instanceInThisFile,
})
if (err(result)) throw result
await runNewAstAndCheckForSweep(result.modifiedAst, rustContextInThisFile)
const newCode = recast(result.modifiedAst, instanceInThisFile)
expect(newCode).toContain(circleCode)
expect(newCode).toContain(
`revolve001 = revolve(
profile001,
angle = 10,
axis = X,
bodyType = SURFACE,
)`
)
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra codemod integration test case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good stuff

})
})

describe('Testing retrieveBodyTypeFromOpArg', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New util function used for Extrude and Revolve here in the edit flow, see operations.ts

* Gather up the argument values for the Revolve command
* to be used in the command bar edit flow.
*/
const prepareToEditRevolve: PrepareToEditCallback = async ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do it yet but I'd be keen on trying to spin up an integration test for each prepareToEdit* function here, we rely on e2e for it plus each individual util function called in there but we could benefit from a few arg permutations at this level. Note for later!

Copy link
Contributor

@max-mrgrsk max-mrgrsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selections should be happy with both closed and open profiles, like for extrude. KCL validation will catch the problems in the review phase. You should be able to revolve this curly profile:

Screenshot 2026-01-08 at 19 11 22

/** Version of `toUtf16` bound to our code, for mapping source range values. */
const boundToUtf16 = (n: number) => toUtf16(n, code)
const result = code.slice(...opArg.sourceRange.map(boundToUtf16))
if (result === KCL_PRELUDE_BODY_TYPE_SOLID) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to normalize the lover/upper case here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, are both defined?

}
const res = retrieveBodyTypeFromOpArg(operation.labeledArgs.bodyType, code)
if (err(res)) return { reason: res.message }
bodyType = res
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so much cleaner, love it

@pierremtb
Copy link
Contributor Author

@max-mrgrsk Made the change! Good catch ty

Copy link
Contributor

@max-mrgrsk max-mrgrsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good stuff, I've revolved these

Image

with 0 problems into these

Image

great PR, ty!

@max-mrgrsk
Copy link
Contributor

When Sketch 2 lands, paths will go away and we’ll switch to separate segments. That change will ripple through the system - especially surface modeling - so we should plan for its impact.

@pierremtb
Copy link
Contributor Author

Agreed! Ty

@pierremtb pierremtb merged commit 3fe5213 into main Jan 8, 2026
56 checks passed
@pierremtb pierremtb deleted the pierremtb/issue9567-ZDS-support-for-Revolve-Surface branch January 8, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bodyType to Revolve P&C

3 participants