Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
VTK
VTK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 582
    • Issues 582
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 160
    • Merge Requests 160
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #17131

Closed
Open
Opened Sep 26, 2017 by tnassour@tnassour

BooleanOperationFilter crashes my application with : Access Violation Exception

Hello, I have an access violation exception with

This is the function that throw the exception

	vtkSmartPointer<vtkPolyData> MeshesBuilderMock::booleanOperationIntersection(vtkSmartPointer<vtkPolyData> meshA, vtkSmartPointer<vtkPolyData> meshB)
	{
		auto booleanOperation = vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
		booleanOperation->SetOperationToIntersection();
		booleanOperation->SetInputData(0, meshA);
		booleanOperation->SetInputData(1, meshB);
		booleanOperation->Update();

		return booleanOperation->GetOutput();
	}

There are two STL files that I have created this way :

vtkSmartPointer<vtkPolyData> MeshesBuilderMock::getCube(double x, double y, double z, vtkSmartPointer<vtkTransform> transform)
{
	auto cubeSource = vtkSmartPointer<vtkCubeSource>::New();
	cubeSource->SetXLength(x);
	cubeSource->SetYLength(y);
	cubeSource->SetZLength(z);
	auto triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
	triangleFilter->SetInputConnection(cubeSource->GetOutputPort());
	triangleFilter->Update();

	auto transformFilter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
	transformFilter->SetInputConnection(triangleFilter->GetOutputPort());
	transformFilter->SetTransform(transform);
	transformFilter->Update();
	return transformFilter->GetOutput();
}

TEST_METHOD(TestCubeAndCrossThatGoesTwoSideOutWithAppend)
{
	auto translation1 = vtkSmartPointer<vtkTransform>::New();
	translation1->Translate(0.0, 0.0, 1.0);
	auto meshA = getCube(120, 120, 100, translation1);
	Utils::writeSTLFile(meshA, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\meshA11.stl");
	auto translation2 = vtkSmartPointer<vtkTransform>::New();
	translation2->Translate(35.0, -35.0, 0.0);
	auto cubeB1 = MeshesBuilderMock::getCube(60, 30, 100, translation2);

	auto translation3 = vtkSmartPointer<vtkTransform>::New();
	translation3->Translate(60.0, 0.0, 0.0);
	auto cubeB2 = getCube(30, 60, 100.0005, translation3);
	
	auto meshB = vtkSmartPointer<vtkAppendPolyData>::New();
	meshB->AddInputData(cubeB1);
	meshB->AddInputData(cubeB2);
	meshB->Update();
	Utils::writeSTLFile(meshB->GetOutput(), "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\meshB11.stl");
/*** THE REST OF THE METHOD HERE**/

}

All commented functions crahes with access violation, the others not :

vtkSmartPointer<vtkPolyData> loopBoolean;

//loopBoolean = booleanOperationIntersection(meshA, meshB->GetOutput());
//Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationIntersectionAB11.stl");
loopBoolean = MeshesBuilderMock::booleanOperationIntersection(meshB->GetOutput(), meshA);
Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationIntersectionBA11.stl");

//loopBoolean = booleanOperationSubstraction(meshA, meshB->GetOutput());
//Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationSubstractionAB11.stl");
loopBoolean = MeshesBuilderMock::booleanOperationSubstraction(meshB->GetOutput(), meshA);
Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationSubstractionBA11.stl");

//loopBoolean = booleanOperationUnion(meshA, meshB->GetOutput());
//Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationUnionAB11.stl");
loopBoolean = booleanOperationUnion(meshB->GetOutput(), meshA);
Utils::writeSTLFile(loopBoolean, "D:\\temp\\TestCudeAndCrossThatGoesOutBothSides\\booleanOperationUnionBA11.stl");

meshB11.stl

meshA11.stl

Edited Oct 23, 2018 by Ben Boeckel
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: vtk/vtk#17131