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 the name of a solid into STL.

Dominik Mokris's picture

Hello everyone,

is it possible to specify what will be written on the first line of an STL file?

When I run

TopoDS_Shape shape;
// (Get the shape from an assembly...)
BRepMesh_IncrementalMesh BMesh(shape, 0.1, Standard_True);

the first line of the STL file says "solid shape, STL ascii file, created with Open CASCADE Technology".
However, I would like to decide what will follow after the "solid" keyword.

Of course, I could copy it line-by-line into a new file and change the line but that sounds like an unnecessarily complicated approach.


Kirill Gavrilov's picture

There is no such an option in STL writer, yet. But it should be pretty simple to implement - you can contribute a patch to OCCT or use support services.

By the way, in case of Binary format, you don't need to re-write entire file - the header section at the very beginning of file is always 80 bytes long, which can be easily overwritten afterwards.

Hugues Delorme's picture

Hello Dominik,

You can use the gmio library for that.

Call function gmio_stl_write() or gmio_stl_write_file() with :

You can also tune the float format and precision of the output (see stla_float32_format and stla_float32_prec).

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.