STL-Export / Import

Hi!

Unfortunatelly we have a big problem with the STL-export / import.
We can't load cadfiles in the stl-format, even the ones we loaded from a step file and saved them as an stl-file with OCC itself.
Everytime we load such a file, an exception is thrown:
--------------------------------------------------------
reading ../data/test_models/sae-stufenheck.stl Type:3
ascii
start mesh
end mesh

*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x540273 : Standard_OutOfRange:
TCollection_IndexedDataMap::FindFromKey[clemens@CLE bin]$
--------------------------------------------------------

The exception is always from type "Standard_outOfRange".

Here is an excerpt from our sourcecode:

--------------------------------------
StlAPI_Reader reader;
reader.Read(m_shapeRoot, (char*)filename.c_str());
----------------------------------------

It's not very complex ;-) I can't see an error in these two lines.
"m_shapeRoot" has the type TopoDS_Shape.
As I mentioned before we have sucessfully used the step-import of OCC, but what the heck is going on with the STL stuff ?

Any help appreciated ...

With kind regards
Benjamin Jung

Forum supervisor's picture

Hello Benjamin,

Open CASCADE Technology open source provides rather limited capabilities to work with STL data. If you are looking for a professional solution, please pay your attention to our advanced components :

- Open CASCADE Mesh Framework (OMF)
This component provides a framework for working with mesh data, in particular it supports several formats to exchange mesh data including STL. Please see more details at http://www.opencascade.org/support/products/omf/.

- Express Mesh (EM)
This component features an advanced algorithm of surface meshing which is necessary in the process of conversion of a topological model into a mesh model. Please see more details at http://www.opencascade.org/support/products/emesh/.

Best regards,
Forum Supervisor

Michael Cook's picture

Hi Benjamin,

I was wondering if you ever solved the import problem. I am having the exact same problem. Here is the line I'm using to try and read in an stl file:

-------------------------------------------------
StlAPI::Read(stlshape, (char*)stlfile.c_str());
-------------------------------------------------

As far as I can tell, this should read the .stl file denoted by 'stlfile.c_str()' into the TopoDS_Shape 'stlshape'.

Thanks,
Mike