How to save a .stl file in binary mode.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to save a .stl file in binary mode.

An-Nhien PHAM
This post has NOT been accepted by the mailing list yet.
Hi everyone,

I used this function to save a STL file in binary mode. But it is not working.


PCL_EXPORTS bool pcl::io::savePolygonFileSTL ( const std::string & file_name,
                                                                                const pcl::PolygonMesh & mesh,
                                                                                const bool binary_format = true
                                                                         )

In my code, I have used:   pcl::io::savePolygonFileSTL("demo.stl",mesh,true);

The IDE told me that:        error C2660: 'pcl::io::savePolygonFileSTL' : function does not take 3 arguments

When I remove true in my code, it's ok but the result is in ASCII mode. It is not good for me.

How can I save it in binary mode. Can anyone point me in the right direction?

Thank you so much.
Reply | Threaded
Open this post in threaded view
|

Re: How to save a .stl file in binary mode.

VictorLamoine
Administrator
Hello,

Which PCL version are you using?
In PCL trunk, the function does take 3 arguments, I have tested it and it works:

http://docs.pointclouds.org/trunk/group__io.html#gaaedafa1bdb0b6c7e1ff5d5601155ee46

You can find an example code to convert from binary to ascii etc. here:
https://github.com/PointCloudLibrary/pcl/blob/master/io/tools/converter.cpp

Bye
Reply | Threaded
Open this post in threaded view
|

Re: How to save a .stl file in binary mode.

An-Nhien PHAM
This post has NOT been accepted by the mailing list yet.
Hi Victor,

I am using PCL version 1.7.0; I also have tested this function in PCL version 1.6.0 but in both cases I received: "error C2660: 'pcl::io::savePolygonFileSTL' : function does not take 3 arguments"


Thank you for your tool.

PHAM.