MantisBT - ParaView
View Issue Details
0008072ParaView(No Category)public2008-11-10 06:442009-05-13 13:45
dh 
Utkarsh Ayachit 
lowmajorhave not tried
closedfixed 
 
3.6 
0008072: when reading STL files. points are not displayed, surfaces ignored
In Information:
Number of Cells: 0
Number fo Points: 7627
(points are not displayable, even when setting representation to points).
Shells/triangles do not appear at all.
No tags attached.
gz Explorer.k.small.stl.gz (658,251) 2008-11-10 06:44
https://www.vtk.org/Bug/file/6840/Explorer.k.small.stl.gz
cxx vtkSTLReader.cxx (10,956) 2008-11-17 11:50
https://www.vtk.org/Bug/file/6848/vtkSTLReader.cxx
Issue History
2008-11-10 06:44dhNew Issue
2008-11-10 06:44dhFile Added: Explorer.k.small.stl.gz
2008-11-14 04:12FrancescoNote Added: 0014107
2008-11-17 11:48FrancescoNote Added: 0014126
2008-11-17 11:50FrancescoFile Added: vtkSTLReader.cxx
2008-11-17 11:51FrancescoNote Edited: 0014126
2009-02-17 14:57Utkarsh AyachitStatusbacklog => tabled
2009-02-17 14:57Utkarsh AyachitAssigned To => Utkarsh Ayachit
2009-02-17 14:57Utkarsh AyachitPrioritynormal => low
2009-02-17 14:57Utkarsh AyachitCategory3.4 => 3.6
2009-03-24 12:09Utkarsh AyachitNote Added: 0015788
2009-03-24 12:09Utkarsh AyachitStatustabled => @80@
2009-03-24 12:09Utkarsh AyachitResolutionopen => fixed
2009-03-27 19:46Alan ScottNote Added: 0015821
2009-03-27 19:46Alan ScottStatus@80@ => closed
2009-05-13 13:45Utkarsh AyachitTarget Version => 3.6
2011-06-16 13:10Zack GalbreathCategory => (No Category)

Notes
(0014107)
Francesco   
2008-11-14 04:12   
I've noticed that if you remove all the lines containing the keyword "color" the file is correctly displayed.
I guess it should be enough to skip those lines when reading the ascii STL file to resolve the bug.

I.e.

-----------------8<-------------------------------
solid bw-a-pillar-bottom-LEFT
   color 0.98824 0.13333 0.49804
  facet normal 0.065777868 -0.994380057 0.0829555467
    outer loop
      vertex -1236.36243 709.844604 755.906372
      vertex -1235.98022 708.72937 742.235107
      vertex -1243.3512 708.230164 742.095825
    endloop
  endfacet
  facet normal 0.0584581681 -0.994519949 0.086676009
    outer loop
      vertex -1236.36243 709.844604 755.906372
      vertex -1243.3512 708.230164 742.095825
      vertex -1244.53064 709.432861 756.69104
    endloop
  endfacet
  [...]
-----------------8<-------------------------------

becomes:
-----------------8<-------------------------------
solid bw-a-pillar-bottom-LEFT
  facet normal 0.065777868 -0.994380057 0.0829555467
    outer loop
      vertex -1236.36243 709.844604 755.906372
      vertex -1235.98022 708.72937 742.235107
      vertex -1243.3512 708.230164 742.095825
    endloop
  endfacet
  facet normal 0.0584581681 -0.994519949 0.086676009
    outer loop
      vertex -1236.36243 709.844604 755.906372
      vertex -1243.3512 708.230164 742.095825
      vertex -1244.53064 709.432861 756.69104
    endloop
  endfacet
  [...]
-----------------8<-------------------------------

Hope this helps some developer to write a quick fix to this issue.
(0014126)
Francesco   
2008-11-17 11:48   
(edited on: 2008-11-17 11:51)
I've written a quick fix to this problem.
Here it is the result from the diff command against the official 3.4.0 release:

-----------------8<-------------------------------
[ParaView-3.4.0]$ diff VTK/IO/vtkSTLReader.cxx ../ParaView-3.4.0-release/VTK/IO/
313,316d312
< if ((strcmp(line, "COLOR") == 0) || (strcmp(line, "color") == 0))
< {
< done = (fscanf(fp,"%s %*s %f %f %f\n", line, x, x+1, x+2)==EOF);
< }
361,365d356
< if ((strstr(line, "COLOR") == 0) || (strstr(line, "color") == 0))
< {
< done = (fscanf(fp,"%f %f %f\n", x,x+1,x+2)==EOF);
< done = (fscanf(fp,"%s", line)==EOF);
< }
-----------------8<-------------------------------

Basically, the only routine changed is vtkSTLReader::ReadASCIISTL, adding the check on a possible "color" line just after every time the parsing of a solid block starts.

The proposed modification can read STL ascii files with and without the "color" line.
The modified file is attached.

I hope this helps and the fix, or a better version, could be eventually included in the next release.

Francesco

(0015788)
Utkarsh Ayachit   
2009-03-24 12:09   
Committing reporter's patch to handle stl ascii files containing "color" lines.

/cvsroot/ParaView3/ParaView3/VTK/IO/vtkSTLReader.cxx,v <-- VTK/IO/vtkSTLReader.cxx
new revision: 1.75; previous revision: 1.74
(0015821)
Alan Scott   
2009-03-27 19:46   
Looks fixed to me.
Tested local client, XP.