Skip to content

Conversation

@adamchalmers
Copy link
Contributor

@adamchalmers adamchalmers commented Jan 13, 2026

Most solids are based on a sketch, but there's really no need to have the full sketch as a field of the solid. It's really only used for two things:

  1. Holding the tags from the sketch, so that the edge tagged a can become the face a when extruded
  2. Knowing the ID of the original sketch, because it'll become the ID of the solid

As part of Serena's in-progress work for extruding faces (#8661), this won't be the case -- the solid extruded from a face won't be based on a sketch.

So I am refactoring it to use a new type SketchBase instead. It's like Sketch but it only has a subset of its fields. In the future, we can make SketchBase an enum, so that solids created through other means have a different set of fields.

@adamchalmers adamchalmers requested a review from a team as a code owner January 13, 2026 02:27
@vercel
Copy link

vercel bot commented Jan 13, 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 13, 2026 3:56am

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 13, 2026

Merging this PR will not alter performance

✅ 152 untouched benchmarks
⏩ 92 skipped benchmarks1


Comparing achalmers/sketch-base-codex (f7a59b7) with main (586c26f)2

Open in CodSpeed

Footnotes

  1. 92 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (6dd0bdc) during the generation of this report, so 586c26f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Contributor

@jtran jtran left a comment

Choose a reason for hiding this comment

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

tsc error looks real.

(KclValue::Solid { value }, Property::String(prop), false) if prop == "sketch" => Ok(KclValue::Sketch {
value: Box::new(value.sketch),
(KclValue::Solid { value }, Property::String(prop), false) if prop == "sketch" => {
let source_range = SourceRange::from(self.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to avoid cloning the entire AST node with something like this.

Suggested change
let source_range = SourceRange::from(self.clone());
let source_range = SourceRange::from(self);

.collect(),
constrainable: false,
(KclValue::Sketch { value: sk }, Property::String(prop), false) if prop == "tags" => {
Ok(tags_object_from_map(&sk.tags, SourceRange::from(self.clone())).continue_())
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing about cloning.


pub(crate) fn merge_tags<'a>(&mut self, tags: impl Iterator<Item = &'a TagIdentifier>) {
for t in tags {
match self.tags.get_mut(&t.value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could probably use the Entry API here.

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.

3 participants