Replies: 1 comment 2 replies
-
rect (from docstring): Make a rectangle for each item on the stack. After the hole is cut, the item on the stack is a Compound with center (0, 0, 0).: .faces(">Z").workplane().hole(diameter) The following rect is then moved to z=0. The QuickStart example resolves this by creating a new Workplane. The objects list is then empty. Another way is to select the >Z face so the item on the stack is a Face with center (0, 0, 5). height = 60.0
width = 80.0
thickness = 10.0
diameter = 22.0
padding = 12.0
# make the base
result = (cq.Workplane("XY")
.box(height, width, thickness)
.faces(">Z").workplane().hole(diameter)
.faces(">Z")
.rect(height - padding, width - padding, forConstruction=True)
.vertices().cboreHole(2.4, 4.4, 2.1)
) There is a note in the docstring regarding this behavior:
FYI, CQ-editor provides an object stack inspector that displays the origins of all Workplanes in addition to the items on the stack. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was going through the official quickstart demo. What confused me is line 11, where the top face is selected for the second time:
Why the same face has to be selected again, in other words, why the workplane has to be created again? I tried to delete that line, of course ending up with an unwanted result. In order to get the reason, I broke the chain, and re-wrote the code in juyter as follows:
It can be seen that, in order to see the difference between before and after the workplane creation, I drew two rectanges, and checked the origins of all the Workplanes.
The result is suprising:
From the result we can see that, after drilling the hole, all the Workplanes are pysically the same planes, but the two rectangles are created based on different planes as shown below:
It seems that after drilling the hole, the rectangle is created based on (0,0,0).
So, can anyone tell me where it all went wrong? Thank you so much.
Beta Was this translation helpful? Give feedback.
All reactions