-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
The BuildSketch in a method failed to add faces to the outside BuildPart context #723
Comments
In Python, the If you're an expert in this area of Python I'd welcome any improvements that could be made. Otherwise, this isn't supported. Of course, there are other ways to achieve the same goal. |
Interesting. I thought the builder would use some kind of global variables to maintain the context. So for now, how can I encapsulate common operations under builder mode into a function? |
Can you elaborate on that? |
Maybe I'm not using the correct terminology here, but yes |
@gumyr I'm not sure I understand all of the implications for every possible |
Global variables aren't used as that could make multi-threading fail. All build123d "operations" are just Python functions, take a look at operations_generic.py which has many examples (these generic operations operate with more than one builder type). You'll find if context is not None:
context._add_to_context(new_wire, mode=Mode.REPLACE) which is instructing the builder to combine this new object(s) with its existing object with the given However, from the examples you've shown above it appears that you want to create custom objects which is described here: custom-objects By creating a sub-class of say with BuildPart() as obj:
with BuildSketch() as card:
Club(height=10)
Circle(2, mode=Mode.SUBTRACT)
extrude(amount=1) |
This is how it works currently, see: https://github.com/gumyr/build123d/blob/dev/src/build123d/build_common.py#L234 However, improvements are welcome. |
yes that is the function I proposed a modification of. Instead of checking that |
This is really helpful. Thank you! |
I tried the following three scenarios:
This worked, of course.
This also worked.
This failed at the
extrude
step with error "A face or sketch must be provided". I looked into it a little bit. After finishing theBuildSketch
process, thepending_faces
field of theBuildPart
context was supposed to contain a face, but it didn't. Why?The text was updated successfully, but these errors were encountered: