# How can I convert .STL file to .OFF to use in CGAL?

I want to skeletize the surface mesh. For that I need to export .STL from Solidworks and then convert that into .OFF file to be able to use it in CGAL library for skeletonzation. How can I do this?

• Look at MeshLab it imports and exports both .stl and .off I have not used .off so not familiar on how well MeshLab handles them. MeshLab is open source. Nov 21 '16 at 17:05

If you can handle a single intermediate step, you may find that OpenSCAD will perform as required. As a test, I created a cube 10 x 20 x 5 within OpenSCAD. I kept the model simple, hoping the code generated would be short.

The results:

OFF


8 12 0

0 0 5

10 0 5

10 20 5

0 20 0

0 0 0

10 0 0

10 20 0

0 20 5

3 4 5 1

3 0 4 1

3 0 7 4

3 4 7 3

3 0 1 2

3 7 0 2

3 3 6 4

3 4 6 5

3 5 6 2

3 1 5 2

3 7 2 3

3 3 2 6

In your example, it would be necessary to use the import_stl feature of OpenSCAD, then render the model. Once rendered, use File, Export, Export as OFF to create the file you need.

I cannot provide certainty of the exported code, however, as I am not familiar with the format you seek.

I would suggest using Meshlab. You can convert from .stl to .off and you can try other operations for quick results too, instead of diving to code for mesh manipulation.