gumyr / build123d

A python CAD programming library
Apache License 2.0
553 stars 93 forks source link

Part mirroring, and its interaction with Joint classes. #105

Open ezrec opened 1 year ago

ezrec commented 1 year ago

I have some thoughts about mirroring parts, with respect to Joints.

Naively, if the joint orientation axes are mirrored along with the part, then the part's joining to other parts would not be as expected.

For example, imagine a wedge (Wo) pointing in the positive X direction, with a RigidJoint() at (10, 0, 0) at the tip of the wedge. Let's make Wm to be a naive mirror of Wo (mirrored in the YZ plane). The RigidJoint() is now at (-10, 0, 0) , with a mirrored orientation. Now let's mount Wo and Wm to a rail with an unrotated LinearJoint().

My argument is that if we provide a part.mirror(x, y, z)) feature that cascades to Joints in the source part, it should:

This is pretty off the cuff thinking, there's probably some edge cases I'm missing.

gumyr commented 1 year ago

This sounds like a good feature but potentially a tricky one. Mirror is a transformation operation - in that it changes the CAD object much like scale does - as opposed to a positioning operation that just changes the object's location. However, it seems possible to apply the same transformation to the Joint such that the relative location relationships are maintained. I'll have to do some experimentation...