-
-
Notifications
You must be signed in to change notification settings - Fork 511
Add enclose bool op #2059
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
base: master
Are you sure you want to change the base?
Add enclose bool op #2059
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,8 @@ | |
| BOPAlgo_FUSE, | ||
| BOPAlgo_CUT, | ||
| BOPAlgo_COMMON, | ||
| BOPAlgo_MakerVolume, | ||
| BOPAlgo_Splitter, | ||
| ) | ||
|
|
||
| from OCP.IFSelect import IFSelect_ReturnStatus | ||
|
|
@@ -6879,14 +6881,43 @@ def split( | |
| Split one shape with another. | ||
| """ | ||
|
|
||
| builder = BRepAlgoAPI_Splitter() | ||
| _bool_op(s1, s2, builder, tol) | ||
| builder = BOPAlgo_Splitter() | ||
| _set_builder_options(builder, tol) | ||
|
|
||
| builder.AddArgument(s1.wrapped) | ||
| builder.AddTool(s2.wrapped) | ||
|
|
||
| builder.Perform() | ||
|
|
||
| _update_history(history, name, [s1, s2], builder) | ||
|
|
||
| return _compound_or_shape(builder.Shape()) | ||
|
|
||
|
|
||
| def enclose( | ||
| *shapes: Shape, | ||
| tol: float = 0.0, | ||
| history: History | None = None, | ||
| name: str | None = None, | ||
| ) -> Shape: | ||
| """ | ||
| Build a solid enclosed by the specified faces. Faces can intersect or touch. | ||
| If all faces are touching, solid() has better performance. | ||
| """ | ||
|
|
||
| builder = BOPAlgo_MakerVolume() | ||
| _set_builder_options(builder, tol) | ||
|
|
||
| for s in shapes: | ||
| builder.AddArgument(s.wrapped) | ||
|
|
||
| builder.Perform() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, if the faces are non-intersecting and non-overlapping (i.e. two separate parallel faces or two crossing planes), you get a Compound of 0 solids and 0 faces back. Should the code raise an error instead of returning an empty result? |
||
|
|
||
| _update_history(history, name, shapes, builder) | ||
|
|
||
| return Shape.cast(builder.Shape()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does the form of this return deviate from the other free function method returns (fuse, cut, split, etc)? return _compound_or_shape(builder.Shape()) |
||
|
|
||
|
|
||
| def imprint( | ||
| *shapes: Shape, | ||
| tol: float = 0.0, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not really understand the implications of dropping from
BRepAlgoAPI_SplittertoBOPAlgo_Splitter, but I did notice that there does not seem to be a test forsplit()to catch an issue that this might introduce.