[vtkusers] Some Help for a vtk beginner!
Adrien Brunet
brunet.adrien at gmail.com
Fri May 30 13:50:11 EDT 2014
Hi Ricky,
I guess that's what I need to do. Thanks a lot all. And if it does work,
I'll check what I can do for vtk :)
Cheers and have a nice week end!
Adrien
Le 30/05/2014 19:46, Ricky Singla a écrit :
> Hi Adrien,
>
> Have you considered using a non-VTK based STL writer? For example:
> http://code.activestate.com/recipes/578246-stl-writer/
>
> Shows how you could write your own in Python. That being said, you
> could always contribute some changes to improve the STL writer in VTK.
>
> Hope this helps.
>
> Cheers,
>
> Ricky Singla
>
>
> On Fri, May 30, 2014 at 10:43 AM, David Gobbi <david.gobbi at gmail.com
> <mailto:david.gobbi at gmail.com>> wrote:
>
> Hi Adrien,
>
> I'm fond of python, too, but why do you think this problem
> is specific to python? It would be the same in any language.
>
> David
>
> On Fri, May 30, 2014 at 11:31 AM, Adrien Brunet
> <brunet.adrien at gmail.com <mailto:brunet.adrien at gmail.com>> wrote:
> > Hi,
> >
> > thanks a ton for this so quick answer!
> > I guess I need to change my tools then, do you have any advice?
> I'm fond of
> > python but I'm ok with any other language...
> >
> > Cheers,
> >
> > Adrien
> >
> >
> > Le 30/05/2014 19:26, David Gobbi a écrit :
> >
> >> Hi Adrien,
> >>
> >> This is the first time that I've heard this question. The
> answer is that
> >> the
> >> vtkSTLWriter is not sophisticated enough to write files with
> multiple
> >> solids.
> >> This is a bit strange, because the vtkSTLReader is capable of
> labeling the
> >> solids when it reads them.
> >>
> >> David
> >>
> >>
> >> On Fri, May 30, 2014 at 11:06 AM, Adrien Brunet
> <brunet.adrien at gmail.com <mailto:brunet.adrien at gmail.com>>
> >> wrote:
> >>>
> >>> 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 !!
> >
> >
> _______________________________________________
> Powered by www.kitware.com <http://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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140530/c2bed399/attachment.html>
More information about the vtkusers
mailing list