[vtkusers] Some Help for a vtk beginner!
Adrien Brunet
brunet.adrien at gmail.com
Fri May 30 13:06:44 EDT 2014
Hi guys,
I hope this has not been already asked but the archives are not really
handy to explore...
I'm converting stl files from ascii to binary and from binary to ascii
with vtk. I use the following code:
#!/usr/bin/env python
import vtk
def convert_stl2ascii(path):
reader = vtk.vtkSTLReader()
reader.SetFileName(path)
reader.Update()
write = vtk.vtkSTLWriter()
write.SetFileTypeToASCII()
write.SetInput(reader.GetOutput())
write.SetFileName(path)
write.Write()
def convert_stl2binary(path):
reader = vtk.vtkSTLReader()
reader.SetFileName(path)
reader.Update()
write = vtk.vtkSTLWriter()
write.SetFileTypeToBinary()
write.SetFileName('_binary.stl'.join(path.split('.stl')))
write.SetInput(reader.GetOutput())
write.Write()
It does work BUT, Let's say I have a ascii stl file like this:
|solid first_name
[...]
endsolid
solid second_name
[...]
endsolid|
I can convert it to a binary file but when I try to convert it back to
ascii, I get something like:
|solid ascii
[...]
endsolid|
What should I do to keep the Region name first_name and second_name and
to avoid that several different regions to be merged in only one region?
Cheers !!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140530/8b9754a6/attachment.html>
More information about the vtkusers
mailing list