For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Write STL to string

John Spataro's picture
Forums: 

Hello,

I'm wondering if there is a way to write the Stereolithography (STL) data from a TopoDS_Shape to a container in program memory instead of to a file on disk.

I'm building an application where one component needs to read an STL file for a lot of objects and I don't want the disk I/O overhead.

Thanks

Forum supervisor's picture

Hello John,

We have sent a private reply to you - please, check your mailbox.

Best regards,

Forum supervisor

Hugues Delorme's picture

Hello John,

You can use the gmio library.

gmio supports writting the internal triangulation of TopoDS_Shape objects, see here for the list of supported OpenCascade classes.

gmio works on "abstract" streams it's not limited to files.

You can easily provide a stream of your own that writes to a memory block.

Note that gmio provides also ready-to-use streams for QIODevice and C++ std streams.