-
Notifications
You must be signed in to change notification settings - Fork 35
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
Bug on model load due to change in VTK API between version 5 and 6 #4
Comments
Fix didn't work... |
Hi @robotsinthesun !
so the problem now is with the vtkClipPolyData in the VTK pipeline. I haven't been able to figure out what it's for, what it does, what it clips, and against what (I have no prior knowledge of VTK), but I have figured out that the implicit function in the ClipPolyData is not set, so it should be using the input data's scalars. According to the VTK source code (http://web.mit.edu/16.225/dv/VTK/Graphics/vtkClipPolyData.cxx - RequestData()), it will do a GetPointData() on the Input, then GetScalars() on that PointData, and in both VTK 5 and VTK 6, that GetScalars returns None. I have also checked that the ImplicitFunction is indeed set to NULL for both VTK 5 and VTK 6 (by enabling the GenerateClipScalars and getting the error "Cannot generate clip scalars if no clip function defined" instead), however, in both VTK 5 (I checked 5.10 source) and VTK 6 (6.3), the source code for PolyClipData hasn't changed, the logic is the same, however, the error happens only with VTK 6, so I have no idea why that is. And if I want to fix it, what am I supposed to do ? Should I call SetScalars on the input's PointData, and if yes, what data/scalars should I give it (I don't know yet what scalars even mean in this context). I am hoping that once we get it ported to VTK 6, the crashes (issue #1) will disappear, because it might be a bug in the VTK 5 python module, if not, at least, I should be able to investigate it now on my system and hopefully fix it quickly (I am currently using a Virtual Machine for testing/debugging with VTK 5, which is pain considering the VM needs to use most of my laptop's RAM otherwise python gets Killed by the kernel due to an out of memory error because of the huge memleak during slicing) |
Hi Youness, I've looked into migrating to VTK 6 myself and found it pretty confusing. The vtkClipPolydata is the filter that clips all stl faces that have Unfortunately, I don't have time to work on this until next week. I've also thought about migrating to OpenGL for the slicing. VTK is Regarding the changes you make: is there a way to get them back into my Hope this helps you a bit! How do you want to proceed? Best, On 18.10.2016 00:31, Youness Alaoui wrote:
|
Hi @kakaroto |
Hi Paul, Yes, the VTK migration is indeed pretty confusing, especially since VTK itself is confusing for me. I've figured out the SetInputConnection/SetInputData changes, as well as the required changes for AllocateScalars for example. But for some of the things to not work as expected, that's where the confusion is. I've figured out the ClipPolyData issue! The problem was "where does the scalars get set" and that was my mistake, the GetNormalZComponent was throwing an error because of the I'm currently concentrating on the vtk migration because I only have vtk 6 on my system and for me to fix the memory/crashes issues i need to be able to test on my system rather on a VM. I'm close though :) I don't know about the OpenGL migration, it might be a good idea. If VTK is causing more issues than it's preventing, then it would be a good idea to move away from it. But I know almost nothing about openGL and nothing about VTK, so I'm not the right person to ask I guess. If you want to merge my changes, you can wait for a pull request, and do it automatically using the github web page, but you can also do it manually, and without the need for a pull request. I didn't send a pull request though because the VTK migration is not done, and I tend to do that only when a feature or bug is complete. I only showed you the branch so you could see the changes I did. Anyways, to merge it manually, you can do this :
As for the deep copy, that's good, because I was thinking that if the problem is not a race condition in the VTK multithreaing, then it's with a race condition in the python threads that are both accessing the same data. I thought though that python was thread-safe, but i've now found out that you need to explicitely mutex your variable accesses between python threads. |
And it looks like the cell locator issue is caused by the stl itself! I realized I get the same error on vtk5!
|
I think the "no cells to subdivide" warnings can be ignored. The probably result from my mechanism of creating the supports. I create a grid of vertical lines inside the model's bounding box. Then, I intersect these lines with the overhang mesh of the model. If the overhang region is smaller than the bounding box (which is the case almost everytime), no intersection can be found by the cell locator for some of the vertical lines. That's what creates the warning. How are you getting along with the VTK migration? If there's anything I can do, please let me know! |
Ah ok, that makes sense. From what I can gather, it's caused by giving a polydata as input to the pipeline instead of setting some actual source and link it with SetInputConnection instead of SetInputData. But I tried changing the pipeline by passing the filename to the slicer thread instead of the model polydata, and using a new stlReader and passing the connection to the cuttingFilterModel, but it didn't change anything. I'm going to try to simplify the pipeline and see if I can get something trivial to work then expand on it until I have the bug reappear. |
Ha! I got it to work! :D |
I figured out why the preview was empty in the slicing tab, it was because the AppendPolyData was using AddInputData (since AddInputConnection doesn't exist in VTK6), and apparently that doesn't work. |
Thanks for merging PR #9. This issue can be closed now. |
I have tried to test monkeyprint and got it to run, but when I tried to load a .stl, I got the following error:
—
Traceback (most recent call last):
File “/home/sebste/Projekte/Software/Playground/monkeyprint/monkeyprintGui.py”, line 1721, in callbackLoad
self.modelCollection.add(filename, filepath)
File “/home/sebste/Projekte/Software/Playground/monkeyprint/monkeyprintModelHandling.py”, line 544, in add
self[modelId] = modelContainer(filenameOrSettings, self.programSettings, self.console)
File “/home/sebste/Projekte/Software/Playground/monkeyprint/monkeyprintModelHandling.py”, line 63, in init
self.model = modelData(filename, self.settings, programSettings, self.console)
File “/home/sebste/Projekte/Software/Playground/monkeyprint/monkeyprintModelHandling.py”, line 857, in init
self.slicerThread = backgroundSlicer(self.settings, self.programSettings, self.queueSlicerIn, self.queueSlicerOut, self.console)
File “/home/sebste/Projekte/Software/Playground/monkeyprint/monkeyprintModelHandling.py”, line 1953, in init
self.sectionStripperModel.SetInput(self.cuttingFilterModel.GetOutput())
AttributeError: SetInput
The text was updated successfully, but these errors were encountered: