Skip to content

Add layered-mesh keywords to SolidModelsExperimental.Extrude - #378

Merged
parrangoiz merged 2 commits into
mainfrom
arrangop/extrude-num-elements
Nov 14, 2026
Merged

parrangoiz merged 2 commits into
mainfrom
arrangop/extrude-num-elements

Conversation

@parrangoiz

Copy link
Copy Markdown
Contributor

The num_elements, heights, and recombine keywords were missing. This adds them and passes them down verbatim.

@parrangoiz
parrangoiz requested a review from gpeairs November 12, 2026 00:38
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gpeairs gpeairs left a comment

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.

Minor comments, otherwise LGTM

ArgumentError("Extrude heights must have one entry per num_elements entry")
)
isempty(heights) ||
(issorted(heights; lt=<=) && 0 < first(heights) && last(heights) <= 1) ||

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.

I think we actually need last(heights) ≈ 1 if you want to catch that as well

- `num_elements`: Number of mesh element layers in each sub-layer of the extrusion. Empty
(the default) meshes the extrusion unstructured.
- `heights`: Cumulative heights of the sub-layers, normalized to 1. Empty (the default) means a
single sub-layer; otherwise it has one entry per entry of `num_elements`.

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.

You can have empty heights with non-empty num_elements, in which case each num_elements entry gets an equal-height sub-layer

Extrude accepts num_elements, heights, and recombine, the extrusion-mesh
keywords of SolidModels.extrude_z!, and passes them to it, so an extrusion can
be meshed as structured layers (e.g. high-aspect via barrels, which gmsh meshes
badly unaided). The constructor checks that element counts are positive and
that heights, if given, has one entry per num_elements entry and increases
within (0, 1]. Both compiled paths forward the keywords, including the deferred
to_level extrusion. Adds compile-level tests and an end-to-end test counting
the mesh segments along layered extrusions, and a CHANGELOG entry.
Extrude now rejects `heights` whose last entry is not approximately 1,
instead of accepting any last entry up to 1, since the heights are
cumulative and normalized. A test covers heights that stop short of 1.
The docstring now says that empty `heights` gives the `num_elements`
sub-layers equal heights, rather than a single sub-layer.
@parrangoiz
parrangoiz force-pushed the arrangop/extrude-num-elements branch from 87029db to d70ffb5 Compare November 13, 2026 19:46
@parrangoiz

Copy link
Copy Markdown
Contributor Author

Cool, addressed your comments and rebased

@parrangoiz
parrangoiz merged commit 0fb7c57 into main Nov 14, 2026
16 of 17 checks passed
@parrangoiz
parrangoiz deleted the arrangop/extrude-num-elements branch November 14, 2026 01:00
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.

2 participants