Skip to content

Few shape/free func related fixes#2033

Open
adam-urbanczyk wants to merge 87 commits into
masterfrom
adam-shape-fixes
Open

Few shape/free func related fixes#2033
adam-urbanczyk wants to merge 87 commits into
masterfrom
adam-shape-fixes

Conversation

@adam-urbanczyk
Copy link
Copy Markdown
Member

@adam-urbanczyk adam-urbanczyk commented May 7, 2026

  • Fix uIsoMatrix and vIsoMatrix single float param handling
  • Use a more robust solver for constrainedApproximate2D
  • Rework check to produce output (warnings) by default
  • Add Shape.reverse
  • Extend siblings to support multiple levels at once
  • Fix solid free function handling of multiple inner cavities
  • Add offset2D
  • Tests

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 98.83721% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.64%. Comparing base (a637795) to head (6cc6965).

Files with missing lines Patch % Lines
cadquery/occ_impl/shapes.py 98.64% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2033      +/-   ##
==========================================
+ Coverage   95.62%   95.64%   +0.01%     
==========================================
  Files          30       30              
  Lines        8893     8956      +63     
  Branches     1311     1326      +15     
==========================================
+ Hits         8504     8566      +62     
  Misses        240      240              
- Partials      149      150       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adam-urbanczyk adam-urbanczyk linked an issue May 10, 2026 that may be closed by this pull request
@adam-urbanczyk adam-urbanczyk marked this pull request as ready for review May 13, 2026 23:11
Comment thread cadquery/occ_impl/shapes.py Outdated
it.Next()

def ancestors(self, shape: "Shape", kind: Shapes) -> "Compound":
def ancestors(self, ctx: "Shape", kind: Shapes) -> "Compound":
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will this parameter name change break existing scripts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It could, but every time I used this method I was confused. And AFAIR I implemented it...

Comment thread cadquery/occ_impl/nurbs.py
Comment thread tests/test_shapes.py
assert siblings_1.size() == 4

siblings_12 = f.siblings(simple_box, "Edge", (1, 2))
assert siblings_12.size() == 5
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this intended to be order dependent?

print(f.siblings(simple_box, "Edge", (1, 2)).size()) # 5
print(f.siblings(simple_box, "Edge", (2, 1)).size()) # 1 

Siblings bug: Visualize with fig. The level 3 faces are missing (blue).:

from cadquery.func import box, fuse
from cadquery.fig import Figure

fig = Figure()
fig.clear()

solid1 = fuse(
    box(1, 1, 1),
    box(1, 1, 1).moved(x=1),
    box(1, 1, 1).moved(x=2),
    box(1, 1, 1).moved(x=3),
)

seed = solid1.face("<X")

level_1 = seed.siblings(solid1, "Vertex", 1)
level_2 = seed.siblings(solid1, "Vertex", 2)
level_3 = seed.siblings(solid1, "Vertex", 3)
actual_123 = seed.siblings(solid1, "Vertex", (1, 2, 3))

fig.show(
    seed,
    name="seed",
    color="Black",
    alpha=1.0,
)

fig.show(
    solid1,
    name="solid1",
    color="LightGray",
    alpha=0.2,
)

fig.show(
    level_1,
    name="level_1",
    color="Red",
    alpha=0.8,
)

fig.show(
    level_2,
    name="level_2",
    color="Green",
    alpha=0.8,
)

fig.show(
    level_3,
    name="level_3",
    color="Blue",
    alpha=0.8,
)

fig.show(
    actual_123.moved(z=1),
    name="actual_123",
    color="Orange",
    alpha=0.8,
)

fig.iso()
fig.fit()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, will investigate.

Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reverse face orientation

3 participants