Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deepcopy doesn't work #9

Open
martin-t opened this issue Oct 31, 2016 · 1 comment
Open

Deepcopy doesn't work #9

martin-t opened this issue Oct 31, 2016 · 1 comment
Labels

Comments

@martin-t
Copy link

Attempting to make a deep copy and modify it

from copy import deepcopy

stl = admesh.Stl('hellskull.stl')
stl_copy = deepcopy(stl)
stl_copy.rotate_z(5)

results in admesh.AdmeshError: STL not opened.

@hroncok hroncok added the bug label Oct 31, 2016
@hroncok
Copy link
Member

hroncok commented Sep 18, 2017

This is how it's done in the Ruby bindings. https://github.com/admesh/radmesh/blob/78ab1d369a12708f1a52d1abf6fe278dfebb370c/lib/radmesh/stl.rb#L705

In Python, we need to define the __copy__() and __deepcopy__() methods. The first will probably just share the C object pointer, the second will mimic the Ruby behavior.

Idea: Add a stl_deepcopy or stl_clone function to C ADMesh and use it both here and in the Ruby bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants