Skip to content

Add ability to select sketch regions for extrude, revolve, etc #4440

@franknoirot

Description

@franknoirot

Warning

This issue is fraught with indirect representations and complex code mods to navigate that indirection. If it proves too difficult, it may be worth prioritizing a direct representation in engine and KCL, or choosing to leave it out of V1.

Sketch regions are a commonly-used concept in CAD modeling. A sketch may contain many closed or open profiles, and a sketch region could be defined as the intersection of two or more closed profiles. Supporting this concept allows users to, for example, sketch a plate and the holes they want in its corners in the same sketch, and then when extruding, exclude the holes in the extruded sketch region.

TradCAD demos

Note in these demos how it is not the entirety of the outer profile that is selected for extrusion, but rather the region of the outer profile excluding any inner profiles. The user can then opt into including any of the inner profiles by clicking inside them afterward to add them to the selection.

Screenshare.-.2024-11-08.11_14_23.AM-compressed.mp4

Engine notes

  1. None, regions are not a concept in-engine. At some point it may be good to have the engine support that concept directly, but initial implementation may not need it.
  2. Previous discussion about the "hole" approach discussed below resulted in an endpoint to detect the profiles that lie within an outer one, which can be found here

API/KCL notes

A region is somewhat representable using a pipe expression from the outermost profile to any inner profiles to be excluded, wrapped with our hole function. One limitation of this is our existing behavior when holed inner profiles intersect the outer profile, since it naively inverts the extrusion and does not exclude the portion lying outside the outer profile.

Here is a video explanation of this hole approach being used with hand-written KCL. A discussion of how this might be automatically done for the user in point-and-click is below.

Screenshare.-.2024-07-10.3_11_33.PM-compressed.mp4

Point-and-click notes

  1. Sketch regions are not created unless needed by a 3D operation
  2. They are marked as needing to be created based on the selection argument step in the command bar
  3. We hit the engine endpoint to get info of the selection location about inner profiles
  4. If any exist, we mark the code mod as needing to generate region, and the outer and inner profiles
    1. I don't believe we have a way to show the user a corresponding visual of these regions until we have an engine-side representation of regions
  5. On operation submission, the code mod will produce a region definition that is a pipe expression of the outer profile and inner profiles holed out, and use that region for the operation instead of the whole sketch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions