-
Notifications
You must be signed in to change notification settings - Fork 44
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
Objects being overwritten from memory during tessellation #94
Comments
Thanks for reporting. I was able to reproduce it. Will look into it |
Thank you for the great analysis and reproducing code! Really appreciate it. You are right, it is the cache function. The cache key uses Now, ..., I know the reason, however, need to find a solution (that is fast, else caching doesn't make sense) |
Thanks for the quick response! Hopefully you find a suitable solution. It's a great package you've built. |
To document an idea: When I read the pybind11 docs (the technology to bring C++ OCCT to Python), a "pybind11 based object" is a Python object that contains a reference to the C++ object.
But if I combine both the Python wrapper object address The change would mean to change jupyter-cadquery/jupyter_cadquery/tessellator.py Lines 46 to 52 in 578b430
to key = (
tuple(( (s.HashCode(MAX_HASH_KEY), id(s) ) for s in shape)),
... Of course, a collision could still happen, however it should be very unlikely. In some initial tests with 10000s of objects I wasn't able to get a collision. And I still can add a switch to turn off caching, if an issue arises. |
Problem:
When using the jupyter cadquery function
jcq.base._tessellate_group(group_to_tessellate)
sometimes objects are pulled from memory rather than thegroup_to_tessellate
I've tried numerous options including:
-make sure I'm deleting objects
-try importing and deleting jcq functions inside each loop
-try passing cq objects through jcq.cad_objects.to_assembly() first (rather than using jcq group)
-running various IDE (cmd, spyder, jupyter)
My best guess if that somehow variables aren't being correctly disposed by jcq or python.
Though, if this is a system specific issue, I'd appreciate any suggestions.
Code to reproduce issue in jupyter notebooks
this code generates rows of boxes, if is find a box pulled from memory rather than the current object it breaks and displays.
Note all block should be in a line, the block out of line is pulled from a previous loop iteration.
System info:
PC: Windows 10 64bit
python: 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:41:22) [MSC v.1929 64 bit (AMD64)]
cadquery: 0.0.0 (funny version number but was installed last month should be 2.?)
jupyter_cadquery: 3.4.0
The text was updated successfully, but these errors were encountered: