async function readPolyData(file: File) {
const toBlob = new Blob([file])
const fileBlob = URL.createObjectURL(toBlob)
const reader = vtkPolyDataReader.newInstance()
await reader.setUrl(fileBlob)
await reader.loadData()
const polydata = reader.getOutputData(0)
mapper.setInputData(polydata)
actor.setMapper(mapper)
renderer?.addActor(actor)
renderer?.resetCamera()
renderWindow?.render()
}
The above is the code for reading the rendering and the rendered model. After adjusting according to the example code provided by the official, the rendering result is incorrect
The following are paragraph headings in the file, with the first character of each line not included in the filtering rule [“-”, 0,1,2,3,4,5,6,7,8,9]
# vtk DataFile Version 5.1
vtk output
ASCII
DATASET POLYDATA
POINTS 1347238 float
METADATA
INFORMATION 2
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 0.0970726 12.1018
NAME L2_NORM_FINITE_RANGE LOCATION vtkDataArray
POLYGONS 2635747 7907238
OFFSETS vtktypeint64
CONNECTIVITY vtktypeint64
CELL_DATA 2635746
SCALARS STLSolidLabeling float
May I ask where the problem occurred and if there is a detailed solution?
I am looking forward to your patient answer!