[vtkusers] Write scalars or vectors data in a STL file

Michael Jackson mike.jackson at bluequartz.net
Mon Jul 18 10:17:56 EDT 2011


Technically you can, but the solution would be custom and my bet is most STL readers would not know how to read your data. The Binary STL file structure has a place at bytes 48 and 49 which is the "length of attributes". From the wikipedia page:
UINT8[80] – Header
UINT32 – Number of triangles

foreach triangle
REAL32[3] – Normal vector
REAL32[3] – Vertex 1
REAL32[3] – Vertex 2
REAL32[3] – Vertex 3
UINT16 – Attribute byte count
end

So one can make their own data structure and place it into the STL file. The problem is that most STL readers assumes that no one has ever done this and makes the really bad assumption that the value is ZERO and so starts reading the next triangle instead of skipping ahead in the file so while you could come up with something it may render your STL files unreadable in anything else. Of course if you have control over the source code that will read the STL file then you can make sure you are "doing the right thing" when it comes to reading the STL File.

___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net 
BlueQuartz Software               Dayton, Ohio

On Jul 18, 2011, at 8:24 AM, Laurent wrote:

> Hi all,
> 
> Is it possible to write out a STL file with scalars or vectors data?
> I tried using SetScalarsName method but it doesn't work.
> I managed to do it in vtk file format but I'm wondering if this can be done
> in STL.
> 
> Thnaks,
> Laurent.
> 
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Write-scalars-or-vectors-data-in-a-STL-file-tp4599243p4599243.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list