<div dir="auto">This problem is because in given polydata the number of tcoords or normals does not match the number of points.  The importer silently skips the polydata. </div><div class="gmail_extra"><br><div class="gmail_quote">On Dec 13, 2017 6:28 PM, "Todd Martin" <<a href="mailto:nztoddler@yahoo.com">nztoddler@yahoo.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px"><div><div>I found a problem similar to this when using  vtkPolyData->SetPoints(). If the point coordinates were not initialised, no polygons were produced. </div><div><br></div><div>I didn't search the code, but it seemed to me that the coordinate values (floats) should be explicitly set to zero when a vtkPoint object is created (or any other object with real values), because I presume the compiler will not do it automatically (unlike integers).</div><div><br></div><div>Todd.<br></div></div>
            <div><br></div><div><br></div>
            
            <div id="m_912883043359082463yahoo_quoted_3869319417" class="m_912883043359082463yahoo_quoted">
                <div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
                    
                    <div>
                        On Thursday, December 14, 2017, 10:45:17 AM GMT+13, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
                    <div><div dir="ltr">I found the problem. The OBJImporter skips any polydata that<br clear="none">          // If some vertices have tcoords and not others (likewise normals)<br clear="none">          // then we must do something else VTK will complain. (crash<br clear="none">on render attempt)<br clear="none">          // Easiest solution is to delete polys that don't have<br clear="none">complete tcoords (if there<br clear="none">          // are any tcoords in the dataset) or normals (if there are<br clear="none">any normals in the dataset).<br clear="none"><br clear="none">If does without warning. Only report the skipping  if debug is on.<br clear="none">This is bad!!!<br clear="none"><br clear="none">I'll try to fix the problem in a different way. At the very least I'll<br clear="none">warn out loud about the skipping.<br clear="none"><br clear="none">I've attached a model.obj that removes the tcoords and normals.<br clear="none"><br clear="none">Bill<br clear="none"><br clear="none"><div class="m_912883043359082463yqt3209121762" id="m_912883043359082463yqtfd51785"><br clear="none">On Wed, Dec 13, 2017 at 3:35 PM, Bill Lorensen <<a shape="rect" href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> wrote:<br clear="none">> There must be a bug in the OBJImporter. It reports 4 actors, but only<br clear="none">> one has polygons. The others report 0 polygons.<br clear="none">><br clear="none">> I'll take a look.<br clear="none">><br clear="none">><br clear="none">> On Wed, Dec 13, 2017 at 2:07 PM, Tony Yuan <<a shape="rect" href="mailto:tonyuanac@gmail.com" target="_blank">tonyuanac@gmail.com</a>> wrote:<br clear="none">>> Hi Sebastien,<br clear="none">>><br clear="none">>> The js loader works fine, but I couldn’t get the same behavior in C++. I<br clear="none">>> tried to see if the reader has multiple outputs, but<br clear="none">>> objReader.<wbr>getNumberOfOutputPorts() returns 1.<br clear="none">>><br clear="none">>> I am interested in getting the mesh as a vtkPolyData, is there a way I can<br clear="none">>> do that with OBJImporter? There seems to be no GetOutput function like<br clear="none">>> OBJReader.<br clear="none">>><br clear="none">>> Tony<br clear="none">>><br clear="none">>> On Dec 13, 2017, at 12:25 PM, Sebastien Jourdain<br clear="none">>> <<a shape="rect" href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.<wbr>com</a>> wrote:<br clear="none">>><br clear="none">>> The file you sent have several materials and I think that the vtkOBJReader<br clear="none">>> just read the first one as it is focusing on the mesh only.<br clear="none">>><br clear="none">>> Your file is correct and I've tried it with vtk.js with success here:<br clear="none">>> <a shape="rect" href="https://kitware.github.io/vtk-js/examples/OBJViewer.html" target="_blank">https://kitware.github.io/vtk-<wbr>js/examples/OBJViewer.html</a><br clear="none">>><br clear="none">>> But you may have more luck with the importer which could also process the<br clear="none">>> mtl file that should come along. That way all the pieces that compose that<br clear="none">>> object will be loaded.<br clear="none">>><br clear="none">>> Seb<br clear="none">>><br clear="none">>> On Wed, Dec 13, 2017 at 9:40 AM, Tony Yuan <<a shape="rect" href="mailto:tonyuanac@gmail.com" target="_blank">tonyuanac@gmail.com</a>> wrote:<br clear="none">>>><br clear="none">>>> Hi,<br clear="none">>>><br clear="none">>>> I have a problem reading Blender OBJ files using VTK. The vtkOBJReader<br clear="none">>>> seems to only read part of the mesh. When I render the data being read it<br clear="none">>>> looks like this:<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> However, when I import the OBJ file in Meshlab it looks fine. Mac’s<br clear="none">>>> Preview is also able to open the complete mesh.<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> I attached the OBJ file and my code below. I am not very familiar with the<br clear="none">>>> OBJ format and how vtkOBJReader is implemented. If someone could point me to<br clear="none">>>> the problem and possible fixes, that would be great.<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> Thanks,<br clear="none">>>> Tony<br clear="none">>>><br clear="none">>>><br clear="none">>>> ______________________________<wbr>_________________<br clear="none">>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br clear="none">>>><br clear="none">>>> Visit other Kitware open-source projects at<br clear="none">>>> <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br clear="none">>>><br clear="none">>>> Please keep messages on-topic and check the VTK FAQ at:<br clear="none">>>> <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br clear="none">>>><br clear="none">>>> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br clear="none">>>><br clear="none">>>> Follow this link to subscribe/unsubscribe:<br clear="none">>>> <a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br clear="none">>>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> ______________________________<wbr>_________________<br clear="none">>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br clear="none">>><br clear="none">>> Visit other Kitware open-source projects at<br clear="none">>> <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br clear="none">>><br clear="none">>> Please keep messages on-topic and check the VTK FAQ at:<br clear="none">>> <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br clear="none">>><br clear="none">>> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br clear="none">>><br clear="none">>> Follow this link to subscribe/unsubscribe:<br clear="none">>> <a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br clear="none">>><br clear="none">><br clear="none">><br clear="none">><br clear="none">> --<br clear="none">> Unpaid intern in BillsBasement at noware dot com<br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Unpaid intern in BillsBasement at noware dot com</div></div><div class="m_912883043359082463yqt3209121762" id="m_912883043359082463yqtfd10548">______________________________<wbr>_________________<br clear="none">Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br clear="none"><br clear="none">Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br clear="none"><br clear="none">Please keep messages on-topic and check the VTK FAQ at: <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br clear="none"><br clear="none">Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br clear="none"><br clear="none">Follow this link to subscribe/unsubscribe:<br clear="none"><a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br clear="none"></div></div>
                </div>
            </div></div></div></blockquote></div></div>