VTK读取文件时显示无法找到(如.stl not found)解决方案

问题:

	//读取模型文件
	vtkSmartPointer obj = vtkSmartPointer::New();
	obj->SetFileName("D:\ct\20201102113826651_3d\pelvis.stl");

在VTK项目运行读取模型文件的代码时,出现以下问题:

ERROR: In vtkSTLReader.cxx, line 106
vtkSTLReader (000001DA1CF5EDD0): File D:ct?01102113826651_3dpelvis.stl not found

ERROR: In vtkExecutive.cxx, line 741
vtkCompositeDataPipeline (000001DA1CF925B0): Algorithm vtkSTLReader (000001DA1CF5EDD0) returned failure for request: vtkInformation (000001DA1CF57980)
  Debug: Off
  Modified Time: 1511
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
  FROM_OUTPUT_PORT: 0

VTK读取文件时显示无法找到(如.stl not found)解决方案_第1张图片

 

解决方案:将代码里的地址改为双斜杠,即可正常读取文件。

 

	//读取模型文件
	vtkSmartPointer obj = vtkSmartPointer::New();
	obj->SetFileName("D:\\ct\\20201102113826651_3d\\pelvis.stl");

 VTK读取文件时显示无法找到(如.stl not found)解决方案_第2张图片

你可能感兴趣的:(VTK_程序报错解决方案汇总,c++,开发语言,vtk)