Replies: 9 comments 14 replies
-
How would this work in Builder mode? |
Beta Was this translation helpful? Give feedback.
-
Builder mode exists for many reasons and I still recommend that new users start with it for a few reasons:
There is more "magic" in Builder mode than Algebra mode but this was very carefully thought out. If you don't like the automatic determination of the "noun" for the operations you can explicitly provide it (i.e. Having said all that, build123d is better for having Algebra mode and I use it quite a bit. |
Beta Was this translation helpful? Give feedback.
-
By diving into Algebra I fear you've made things complex for yourself right from the start. To understand the topology of an object you can do this: print(Box(1, 1, 1).show_topology())
described here: https://build123d.readthedocs.io/en/latest/key_concepts.html#topology. Creating a 3D Sketch as done above is not how a Solid object is created (in-fact a Sketch is intended to be a planar object) . One can create the topological components and assemble them as: Vertices->Edges->Wires->Faces->Shells->Solids->Compounds. For example The rules for implicit in parameters are very simple - take any pending objects created by other builders. with BuildPart() as box_builder:
with BuildSketch() as square_builder:
Rectangle(1, 1)
# upon exit, BuildSketch transfers its object to BuildPart as a pending object
extrude(amount=1) # if no "to_extrude" is provided extrude the pending objects |
Beta Was this translation helpful? Give feedback.
-
@Paul8043 I'm sorry that you find the documentation inadequate to do "real work". The section that specifically addresses the use of pending objects is here: https://build123d.readthedocs.io/en/latest/key_concepts.html#builder-s-pending-objects - would you describe what you think is missing? What might help is actually doing each of the Introductory Examples here: https://build123d.readthedocs.io/en/latest/introductory_examples.html. These take the user through the process of making a very simple shape to covering many of the aspects of build123d. |
Beta Was this translation helpful? Give feedback.
-
Re-reading of the recommended documentation is done. Again, it is well written! I have discovered a few new things that I did no had on my radar (relative positioning, how "add" is used, why a lot of functions have "mode"-parameter). I have also read the small paragraph about Pending Objects. Pending has a negative touch, expressing that something is in bad repair or somehow incomplete. Pending things trigger an alarm for a not normal situation. And this is the reason why this troubles me so much! Maybe the wording leads me to the wrong direction. Maybe this is not so severe as I think at the moment. Build123D let me work with objects, where I cannot see whether they have pending things or not. I also do not understand, when or through what the pending-ness goes away. So, I cannot make any judgements, whether my objects are in pretty good shape or not! Maybe you simply want to say that some results of the current with-statement are automatically routed to the next higher with-statement. That would be a fine service. Can you give a simple example, where you make the pendings visible, just for a better understanding, otherwise my bad feelings in this area would not go away. I want to be sure that my with-statements are correctly designed. This looks impressive, because I have not write any code for the up-propagation, but it has still the smell of some magic-ness. Below I have listed what needs more explanation. Maybe we can solve this first, before we go the real-work-example. Releated to readthedoc: Typo: Worklanes: Second line should get "..." to indicate that a 3D-part is needed
Typo: Locations Context: Third with-statement needs a colon at the end.
Question: Locations Some with-statements take care for a single entity, some others like Locations seems to organize a hidden loop. This is a great feature. I have to look into the source-code, just to see how this is implemented. Are there any further classes with this behavior? Question: Combining Modes Mode.REPLACE is unclear. I have a perception what will be added, but not which portion of the parent will be replaced? Can you give an example? Normally I try to melt the single parts together with the union-operator "+" or cut something away the intersection-operator "-". This works quite well for parts. I do not know whether this works also for 2D-objects. The much bigger questions is, when to use the mode-parameter and when the union and intersection-operators? For me, at the moment, it seems both relalize the same or simliar functionality. Is there a superposition of both mechanisms? What is the intended usage? Question: Using Locations & Rotating Objects A location consists of a position and a rotation. It seems that the rotation is executed first, even it is the second parameter. If some are chained together with the "*"-operator, in which sequence is the positioning executed? Rotations are not commutative, so the execution order is relvant. Locations from left to right, and whitin each location, the rotation first, then the translation? Is this correct? Can rotations be grouped by parenthesis? Improvement & Question: Workplanes All examples should use the same kind of importing, remove the bd, it distracts from the main subject. BuilderMode creates workplanes for all faces. For me left,right,front,back look fine, but top,bottom not, they appear flipped to me. I have already learned, the xdir has not the expected value. Is there an easy way to fix that?
I have to re-address this subject in the next section again. |
Beta Was this translation helpful? Give feedback.
-
In this chapter I want to explain why the inductory examples are easy, and why "real_work" is much harder. This happens not because of the "real_work" is a more complicated model, but it happens as soon as you make some small modifications. As a newbie there is no alternative, you have to take the bottom-up approach. The inductory example is taken as a starting-point, and then you plan to add some refinements (additional extrusions or whatever). The whole thing is advertized as follows: Instead of doing all work with 3D-objects, go to a face and there you only set up 2D-objects, and after that an extrusion will follow which gives the 2D-objects some thickness. And voila you have the wanted appearance (converting a rectangle (2D) into box (3d)). This approach seems to be reasonable. We take the example above (cube with an extruded rectangle on each side). You run the code and you can only say: wow, such an object with just a 5-liner. There was no need to organize a loop, there was no need to specify any location. This is really amazing. A big bargain for a small amount of bucks! In the OCP-CAD-Viewer (a great and very valuable tool) you can inspect the model from every side. Now you try to apply some refinements, may be adding a circle to be extruded in the opposite direction, just to see whether the material is taken away or not. Then you recognize very quickly, the refinements are no easy-doing, they are better characterized as a adventure-trip. Big hurdles enter the scene, they coming from totally unexpected directions. And sometimes I have felt myself as a reborn Odysseus. On some faces the refinements did appear on the right place, on some others they did not. This happens, even the exact same code has be run for all faces. This is a very strange and unexpected behavior, what went wrong, or what did I in a wrong way? If you make such experiments as a newbie, it seems that my small modifications have turned the clear inductory example into one with magic-behavior! During the initial steps of this trip you will be faced with really big hurdles! No other chance, except to look deeper into the faces, also not an easy task. Hurdle 1: Never look into a specific face by using the index of an element! The faces may have any order, they have to be sorted first! Then I was able to select a specific face. But the problem has not changed, on some faces the positions were correct, on others not. To fix the problem I had to exchange the x by y and vice versa. On another face, only the signs were wrong. The positioning was only correct, if I had made totally symmetrical modifications. Hurdle 2: Never use the built-in looping over faces, if your modifcations are not fully symmetrical! Such a behavior made me crazy and I made some considerations whether it would make sense to spend more time on this problem. I am not a person that likes to give up, normally I take the challenge and I will work until a solution has been found. But for this problem, that was clear to me, I cannot do this by myself, I need some assistance from persons who know where the root-cause might be located. I would like to say thank you for all the help I got from you and I also appreciate your responsiveness. Just to make it clear for other readers, the complex of problems described here, is not specific or introduced by Build123D. Other CAD-tools have to deal with these issues, too. The more interesting question would be, how such problems can be resolved inside Build123D. Some deeper investigations led me to planes and how they are attached. I have found x_dir, y_dir, z_dir. It was totally unclear why they are needed, what they control, and what values should be assigned there. I had no perception what is going on here. This hurdle seems to be 5-times higher than the previous ones! In the meantime I have x_dir, y_dir and z_dir under full control. But this issue took me a few weeks to solve. Making own mistakes is a very precious experience, I never will forget the solution, it is now hard-wired in my brain. Now I want to come back to our example. It is still difficult for me to convert BuilderMode-code to AlegebraMode-code and vice versa, espcially if some loops are involved. The code-snippet given below shows an AM-version where the loop is un-roled all items are named properly. In the viewer you can click on them indidually.
Again, left, right, front and back look fine, but the orientation of top and bottom seem dancing out of sync. If the cube is rotated by the x-axis, so that top becomes the new front, the rectangle seems to have a wrong direction, it should go from lower-right to upper-left. Same applies for the bottom-side. If the cube is rotated by the y-axis the orientation of the rectangles seem to be correct. This is not a matter of right or wrong, it is a matter of what the final cube should get. Hurdle 3: There is a common agreement and the same expectation for left, right, back and front, but this is not true for top and bottom. Always check the orientation of the planes used by top and bottom. The default-value for x_dir is (0,+1,0), some models need that x_dir is set to (+1,0,0). This helps that you can iterate over all faces, exactly in the same way.
It seems that BM-code tries to avoid planes at all (that would also be my desire). This would really simplify the code a lot. However I need to know how the internally used x_dir can be adjusted, that top and bottom get the desired orientation? Ok, this is enough for today. |
Beta Was this translation helpful? Give feedback.
-
When creating a Plane from a Face there is insufficient information - specifically the direction of the x-axis is not known. If just the Face is provided, a guess is made by build123d/OCCT as to this x-axis direction but the guess isn't always correct. Therefore, the Plane constructor has an optional |
Beta Was this translation helpful? Give feedback.
-
I've updated the docs to address the concerns here, including showing how pending objects can be accessed. |
Beta Was this translation helpful? Give feedback.
-
I don't see any more users spending so much time on such annoying complaints. Any good programmer can use build123d and create additional tools as needed if the provided API is not comfortable for its desires. I have tried cadquery, i didn't like it, so i tried build123d and i love it. In open source the rules are simple: use for free, contribute if you can, don't be a pain in the ass. |
Beta Was this translation helpful? Give feedback.
-
The old interface of split() has some limitations, therefore a proposal for a new interface:
Beta Was this translation helpful? Give feedback.
All reactions