<div dir="ltr">Hi,<div>I'm using Activiz.Net x64 5.8 from the nuget package.  We are looking to replace WPF graphics with VTK.  What we are trying to do as a starting point is convert some WPF MeshGeometry3D objects into vtkPolyData and display them.  This is working fine and we could see and interact with the models.</div><div><br></div><div>The only problem was that the models looked faceted (WPF calculated the normals automatically and VTK did not).  We went back to add in the vtkPolyDataNormals filter, but are consistently receiving System.AccessVioloationExceptions when executing the pipeline.  I have put together the following code snippet to demonstrate the problem.  If called twice (with the same data), the second time results in the exception being thrown on the normal.Update() call.</div><div><br></div><div><div>vtkPoints points = vtkPoints.New();</div><div>vtkCellArray polys = vtkCellArray.New();</div><div>... populate points and polys ...          </div><div><br></div></div><div><div>vtkPolyData polyData = vtkPolyData.New();</div><div>polyData.SetPoints(points);</div><div>polyData.SetPolys(polys);</div><div>vtkPolyDataNormals normal = vtkPolyDataNormals.New();</div><div>normal.SetInput(polyData);</div><div>normal.Update();</div></div><div><br></div><div>Any ideas?<br></div><div><br></div><div>Could this behavior be from the way that we convert the MeshGeometry3D to vtkPolyData?</div><div><br></div><div><div>                        MeshGeometry3D mesh = ...</div><div><br></div><div>                        vtkPoints points = vtkPoints.New();</div><div>                        points.SetNumberOfPoints(mesh.Positions.Count);</div><div>                        vtkCellArray polys = vtkCellArray.New();</div><div>                        polys.SetNumberOfCells(mesh.TriangleIndices.Count / 3);</div><div><br></div><div>                        for (int i = 0; i < mesh.Positions.Count; i++)</div><div>                        {</div><div>                            points.InsertPoint(i, mesh.Positions[i].X, mesh.Positions[i].Y, mesh.Positions[i].Z);</div><div>                        }</div><div>                        for (int i = 0; i < mesh.TriangleIndices.Count; i++)</div><div>                        {</div><div>                            vtkIdList trianglePoints = vtkIdList.New();<br></div><div>                            trianglePoints.SetNumberOfIds(3);</div><div>                            trianglePoints.InsertId(0, mesh.TriangleIndices[i++]);</div><div>                            trianglePoints.InsertId(1, mesh.TriangleIndices[i++]);</div><div>                            trianglePoints.InsertId(2, mesh.TriangleIndices[i]);</div><div>                            polys.InsertNextCell(trianglePoints);</div><div>                        }</div><div><br></div><div>                        vtkPolyData polyData = vtkPolyData.New();</div><div>                        polyData.SetPoints(points);</div><div>                        polyData.SetPolys(polys);</div></div></div>