-
Notifications
You must be signed in to change notification settings - Fork 289
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
Added AreaNthSelector #688
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
51932b1
Added AreaNthSelector
fedorkotov 109c07d
Fixed error: AreaNthSelector not imported in example 26
fedorkotov fe58219
Using cast to appease mypy type checker
fedorkotov bb7a465
Sacrificing some readability to Black Formatter
fedorkotov cf0286d
AreaNthSelector test docstrings, minor formatting
fedorkotov 981d58b
LengthNthSelector, implementing reviewer changes, abstract _NthSelector
fedorkotov 0fe9abd
removed unused import
marcus7070 93fceff
AreaNthSelector ignores "bad" Wires
fedorkotov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import cadquery as cq | ||
from cadquery.selectors import AreaNthSelector | ||
|
||
case_bottom = ( | ||
cq.Workplane("XY") | ||
.rect(20, 20) | ||
.extrude(10) # solid 20x20x10 box | ||
.edges("|Z or <Z") | ||
.fillet(2) # rounding all edges except 4 edges of the top face | ||
.faces(">Z") | ||
.shell(2) # shell of thickness 2 with top face open | ||
.faces(">Z") | ||
.wires(AreaNthSelector(-1)) # selecting top outer wire | ||
.toPending() | ||
.workplane() | ||
.offset2D(-1) # creating centerline wire of case seam face | ||
.extrude(1) # covering the sell with temporary "lid" | ||
.faces(">Z[-2]") | ||
.wires(AreaNthSelector(0)) # selecting case crossection wire | ||
.toPending() | ||
.workplane() | ||
.cutBlind(2) # cutting through the "lid" leaving a lip on case seam surface | ||
) | ||
|
||
# similar process repeated for the top part | ||
# but instead of "growing" an inner lip | ||
# material is removed inside case seam centerline | ||
# to create an outer lip | ||
case_top = ( | ||
cq.Workplane("XY") | ||
.move(25) | ||
.rect(20, 20) | ||
.extrude(5) | ||
.edges("|Z or >Z") | ||
.fillet(2) | ||
.faces("<Z") | ||
.shell(2) | ||
.faces("<Z") | ||
.wires(AreaNthSelector(-1)) | ||
.toPending() | ||
.workplane() | ||
.offset2D(-1) | ||
.cutBlind(-1) | ||
) | ||
|
||
show_object(case_bottom) | ||
show_object(case_top, options={"alpha": 0.5}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Usually I would insist these lines be changed to
.box(20, 20, 10, centered=(True, True, False))
but this hangs the kernel in the finalcutBlind
step, and I can't work around it either! So it will have to stay as thisrect
version until that bug is fixed. No change required here, this is just a comment.