<div dir="ltr"><div><div><div><div>Hello!<br><br></div>I don't now if this helps, but errors like '.AccessViolations' are mostly (at least for <a href="http://activiz.net">activiz.net</a>) the result of missing references to VTK-objects (cause the .net garbage collector may clean up objects that are still used by VTK).<br></div>See also <<a href="http://www.vtk.org/pipermail/vtkusers/2011-February/066096.html">http://www.vtk.org/pipermail/vtkusers/2011-February/066096.html</a>>.<br></div><div><br><br></div>hth<br><br></div>mirko<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 2, 2016 at 10:16 PM, Karl Smith <span dir="ltr"><<a href="mailto:bulkmailaddress@gmail.com" target="_blank">bulkmailaddress@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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.<wbr>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.<wbr>Positions.Count);</div><div> vtkCellArray polys = vtkCellArray.New();</div><div> polys.SetNumberOfCells(mesh.<wbr>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(<wbr>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(<wbr>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>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Real programmers don't document; if it was<br>hard to write, it should be hard to understand.</div>
</div>