Question on Rhino.Geometry.GeometryBase.Duplicate()

Can’t seem to make it work to duplicate a Rhino.Geometry.Box object… What am I doing wrong?

I tried

>>> message: "expected GeometryBase, got Box"
(didn’t expect that to work, but tried anyway)

(I know I can use the copy module, but I was just curious if that could be avoided)

Hi Mitch,

Box does not inherit from Rhino.Geometry.GeometryBase so it does not have the method Duplicate()

It’s a structure and a quick google and test showed Clone() to work:

box_copy = original_box.Clone()

Please test or wait for Cunningham’s Law to kick in.


Gak… Clone? It’s not listed in the RhinoCommon API Box methods, although it does show up under the Plane structure, so if that’s the general method for making a deep copy of a structure in RhinoCommon, good to know. It does seem to work in this case, thanks.

@dale - maybe this needs to be added to the API Box structure doc? Also the word ‘copy’ is missing from the Plane structure doc…


Got it.

– Dale