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

Difference boolean operation (e.g. A-B) leads to crash #72

Closed
mauigna06 opened this issue Jan 9, 2024 · 7 comments
Closed

Difference boolean operation (e.g. A-B) leads to crash #72

mauigna06 opened this issue Jan 9, 2024 · 7 comments

Comments

@mauigna06
Copy link

Hi @zippy84

Thanks for the amazing software

I can replicate crashes with the file below

vtk_bool_difference_A-B_operation_bug.zip

Hope you can help

PS: I worked around it by adding some filters to the pipeline that creates the cylinders

@zippy84
Copy link
Owner

zippy84 commented Jan 9, 2024

Hello,

do you use the newest version of my lib?

Here is what I get:

grafik

The code I used to created it is:

#!/usr/bin/env python
# *-* coding: UTF-8 *-*

import sys
sys.path.extend(['/home/zippy/vtkbool/build/lib/python3.11/site-packages/vtkbool'])

from vtkmodules.vtkIOLegacy import vtkPolyDataReader, vtkPolyDataWriter
from vtkmodules.vtkIOGeometry import vtkSTLReader, vtkSTLWriter
from vtkmodules.vtkFiltersCore import vtkCleanPolyData, vtkPolyDataNormals, vtkTriangleFilter
from vtkBool import vtkPolyDataBooleanFilter

readerA = vtkPolyDataReader()
readerA.SetFileName('A.vtk')

readerB = vtkPolyDataReader()
readerB.SetFileName('B.vtk')

bf = vtkPolyDataBooleanFilter()
bf.SetInputConnection(0, readerA.GetOutputPort())
bf.SetInputConnection(1, readerB.GetOutputPort())
bf.SetOperModeToDifference2()

clean = vtkCleanPolyData()
clean.SetInputConnection(bf.GetOutputPort())

writer = vtkPolyDataWriter()
writer.SetFileName('result.vtk')
writer.SetInputConnection(clean.GetOutputPort())
writer.Update()

@zippy84
Copy link
Owner

zippy84 commented Jan 9, 2024

Respectively with SetOperModeToDifference:

grafik

@mauigna06
Copy link
Author

do you use the newest version of my lib?

I don't know how to check, I think the files of vtkbool are inside this folder:
https://github.com/PerkLab/SlicerSandbox/tree/master/CombineModels/Logic

It appears they are a few years old

@zippy84
Copy link
Owner

zippy84 commented Jan 9, 2024

Yes, the files there are really old. You should upgrade to version 3.0. The new version is much better!! 😃

@BigBrotherHui
Copy link

Yes, the files there are really old. You should upgrade to version 3.0. The new version is much better!! 😃

where is the newest version of vtkbool?the slicersandbox have't update the logic 3 years age

@lassoan
Copy link

lassoan commented Jan 15, 2024

Thank you, we've updated vtkbool in the Slicer extension now. The current vtkbool version is indeed much cleaner, properly wrapped, and available as a VTK module, so in the future we'll not have to vendorize it anymore.

The only changes I had to make in vtkbool to allow it to build on Windows were:

  • Add #define _USE_MATH_DEFINES to Utilities.cxx (without that build failed due to M_PI symbol was not found).
  • Exclude the _Pair class from wrapping. Maybe it was due to something not being optimal in our CMake files, as Utilities.cxx/.h should not have been even considered by the wrapper; but since Utilities.h was included in Python-wrapped header files, I did not see any easy way around it. For a nice and clean interface, all the private implementation details (such as StripPt, StripPtR, PStrips, etc. classes, and #include "Utilities.h") could be removed from vtkPolyDataContactFilter.h and vtkPolyDataBooleanFilter.h header files (and these classes would be included only in the .cxx files).

@zippy84
Copy link
Owner

zippy84 commented Jan 16, 2024

This is defined by my CMakeLists.txt 😄

@zippy84 zippy84 closed this as completed Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants