Closed bernhard-42 closed 1 year ago
With your PR, can this issue be closed now?
The situation is better, I now get 4 chamfered rectangles with [-2]
and the 4 chamfered triangles with [-3]
If I could provide the center param to group_by, I could use BB which would give me back all 8 rectangles and triangles.
Independent of this use case, given the sensibility of center, I would love to see sort_by and group_by getting an additional parameter center_of
with GEOMETRY as default.
What do you think?
Adding the center_of
seems like a good idea given the complex of the "simple" center calculation.
center
is documented here: https://build123d.readthedocs.io/en/latest/center.html
I have a simple chamfered box:
To my surprise,
group_by
delivers only 6 of 8 faces. Reasons seems to beCenterOf.GEOMETRY
:[o.center(CenterOf.BOUNDING_BOX).Z for o in b.faces().sort_by(Axis.Z)[-9:]]
returns[1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5]
, i.e. all except the top face have z-value 1.4[o.center(CenterOf.GEOMETRY).Z for o in b.faces().sort_by(Axis.Z)[-9:]]
returns[1.35, 1.35, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5]
, i.e. with the default geometry center, two of the triangles have a smaller z-value than the other two.