Open wirekang opened 1 month ago
What is the use case? I.e. are you after a deep or shallow copy in the end?
I thought CadQuery is based on immutable objects, since there are chaining methods with description Returns a copy of...
. So the use case I thought was like:
left_pin = cq.Workplane()...
right_pin = left_pin.translate((0,0,0)) // Oh this is so hacky
cq.Assembly().add(left_pin).add(right_pin)...
You know this is wrong. They shares many things like CQObject and CQContext. If I understand correctly, newObject
has nothing to do with immutable but for parent stack.
So if there is a clone
method, it should deep copy everything, but I can't sure this kind of approche is valid in CadQuery.
I know I can define a function or use
w1.translate((0,0,0))
to create a new reference, but it would be great if there is a simpleclone
method: