Skip to content
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

Circle #3860

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

Circle #3860

wants to merge 47 commits into from

Conversation

Irev-Dev
Copy link
Collaborator

@Irev-Dev Irev-Dev commented Sep 10, 2024


Remaining tasks

  • Draft circle looks funny
  • Cursor should be crosshair when circle tool is equipped
  • Console error when doing the second click for adding the circle Expected [..] to be a sketchGroup, but it wasn't.
  • Extra segment handle is appearing when it shouldn't
  • Fix sketch mode tear down weirdness
  • Disable line tool after rectangle or circle
  • Overlays [absX, absY, and radius]
  • Check line thickness and handles scale correctly with zoom
  • Check exiting out of the sketch after the first click but before the second doesn't do anything weird
  • fix error when dragging circle's circumference
  • Check three dot menu works for circle, (probably need to dump delete short term until multi-profile sketches)
  • Figure what's going on with the cargo tests
  • Make sure circle sketches can be extruded (with UI)

Tests

  • draft circle should look right (snapshot)
  • Can create a new sketch and put a circle on it.
  • Can edit an existing circle changing its center and radius
  • test for the overlay
  • point and click extrude should work with circle sketches.

Copy link

qa-wolf bot commented Sep 10, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Sep 20, 2024 10:24pm

@jtran
Copy link
Contributor

jtran commented Sep 13, 2024

Doc comments that use circle() need to get updated. Maybe shell.rs was added in your last rebase?

/// |> circle([-size / 2, -size / 2], 25, %)

@jtran
Copy link
Contributor

jtran commented Sep 13, 2024

The error message I see a lot of is Expected a Path::ToPoint variant. This is one example that's failing.

/// const sketch001 = startSketchOn('XZ')
/// |> circle({ center: [0, 0], radius: 2 }, %)
/// const extrude001 = extrude(5, sketch001)
///
/// const pattern01 = patternTransform(int(ceil(5 / 2)), (id) => {
/// return { translate: [4 * id, 0, 0] }
/// }, extrude001)

When extruding a circle, do_post_extrude() seems to be expecting a Path::ToPoint to extract an edge ID, but it's not finding it with the circle. Not sure what needs to change here.

if let Path::ToPoint { base } = segment {

@Irev-Dev
Copy link
Collaborator Author

Irev-Dev commented Sep 13, 2024

That is super helpful @jtran thank you.

I think it's because https://github.com/KittyCAD/modeling-app/pull/3860/files#diff-b007215ec7d21c68d6a4487af28c6a25fa8cf5fc95ae008e07e5680261cab1f1L73-L80

circle used to call inner_arc which used ToPoint, but now doesn't. I'm not 100% sure what I need to update yet but at least makes sense why it's unhappy.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 94.84536% with 5 lines in your changes missing coverage. Please review.

Project coverage is 87.16%. Comparing base (3e79b90) to head (414b11d).

Files with missing lines Patch % Lines
src/wasm-lib/kcl/src/executor.rs 50.00% 3 Missing ⚠️
src/wasm-lib/kcl/src/std/extrude.rs 75.00% 1 Missing ⚠️
src/wasm-lib/kcl/src/std/shapes.rs 98.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3860      +/-   ##
==========================================
+ Coverage   87.15%   87.16%   +0.01%     
==========================================
  Files          69       69              
  Lines       25121    25176      +55     
==========================================
+ Hits        21894    21945      +51     
- Misses       3227     3231       +4     
Flag Coverage Δ
wasm-lib 87.16% <94.84%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

1 similar comment
Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

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.

I commented on a couple minor things. But if getting CI to pass was tough, I'd say merge it. Fast follow up PR would be nice though.

@@ -1438,6 +1438,19 @@ pub enum Path {
/// arc's direction
ccw: bool,
},
/// a complete arc
Circle {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry if this is obvious, but, why is Circle a kind of path segment? How can you add more path segments before or after a circle? It doesn't make sense to me to have a circle as part of a sequence of paths. Shouldn't it just be a shortcut for creating a path with 1 segment, a TangentialArc from 0 to 360 degrees?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

inner_arc is very messed up because some of the arc structs are messed up, it returns a path segment using ToPoint, I didn't want to change how the arc segments work in case that's a breaking change. I know if the other arcs are not working correctly I'm just leaving the dirt under the rug and not doing anything about it, but I plan on taking a second pass where I add arcs to the client side scene in which case the arcs structs in rust will probably need some attention too, in which case I'll likely remove this struct again.

I was talking to @jtran about it too, I'll likely remove all but one of the arcs, I don't think there's a need for tangencialArc and arc for example, I think we got confused between the API for users and the functions available to them vs the data we store under-the-hood, I think we only need a struct for each curve type, so straight lines and arcs at this point, but later splines etc etc.

Do you think it's okay to put this circle struct in here short term?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah in the interests of getting this merged I'm happy to include it, but it doesn't really make sense. Let's consolidate this when you fix up the arcs though. Could you just make an issue for it, and leave the issue in the source code here as a comment? So we don't lose track of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good 414b11d

src/wasm-lib/kcl/src/std/shapes.rs Outdated Show resolved Hide resolved
src/wasm-lib/kcl/src/std/shapes.rs Outdated Show resolved Hide resolved
src/wasm-lib/kcl/src/std/shapes.rs Outdated Show resolved Hide resolved
Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

canvas.addEventListener('mouseup', sceneInfra.onMouseUp, false)
canvas.addEventListener(
'mouseup',
toSync(sceneInfra.onMouseUp, reportRejection),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jtran re #3860 (comment)

I think this is the appropriate way to make us toSync right?
I had to change the return types of these callbacks to be promisy/async, but these went listeners need to be synchronous.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

Copy link
Contributor

src/lib/exampleKcl.ts has been updated in this PR, please review and update the src/routes/onboarding, if needed.

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.

4 participants