IGES to STL, conversion

Hi all,

I am trying to use Opencascade to convert an IGES file to STL. is it possible. if yes can any one please let me know

appreciate it and thank you very much

srinivas

Jun WANG's picture

co-ask ???

Patrik Mueller's picture

Hi,

take a look at the ImportExport sample - it should contain all needed infos...

Greets,

Patrik

Jun WANG's picture

Thanks for your information. According to your suggestion, I use ReadIGES() to read the IGES file and then take advantage of "StlAPI_Writer::Write()" to generate stl file. That works well.

However, I got a problem. My IGES file consists of several surface patches. When I use visualize the generated stl file and find that the triangle meshes are not manifold on the boundary of each surface patches. That is to say, the triangle meshes on the boundaries of adjacent surface patches do NOT share vertex and edge, which means that the triangle meshes are generated surface by surface, instead of for the whole IGES model. Here is codes:
-------------------------------
StlAPI_Writer myStlWriter;
myStlWriter.Write(m_topoShape, "tmp.stl");
Handle(StlMesh_Mesh) myMesh = RWStl::ReadFile(OSD_Path("tmp.stl"));
...
-------------------------------

Additionally, I also utilize the APIs: "BRepMesh_FastDiscret" and "BRepMesh_Discret" with setting the parameter of "withShare" as Standard_True to generate triangle meshes. The result is same as above: the triangle meshes are generated seperately. Below is codes:
-------------------------------
double myDeflection = 0.1;
double myDefAngle = 0.17;
try
{
BRepMesh_FastDiscret* myMesh =
new BRepMesh_FastDiscret(myDeflection, m_topoShape, myBox, myDefAngle,
Standard_True, Standard_True, Standard_False, Standard_False);
}
catch (...)
{
BRepMesh_IncrementalMesh(m_topoShape, myDeflection, false, myDefAngle);
}
...
-------------------------------

And alos I use some 3D softwares like CATIA and Geomagic to import my IGES file and export the corresponding STL file. The result is as good as expected.

Does anybody know how to handle this problem ???

Patrik Mueller's picture

Hi Jun,

here's what I do: I use the triangulation from BRepMesh_FastDiscret and collect all resulting vertices in a set - for the triangles I'll take the positions inside the set.
Don't forget to add the transforms to the vertices before adding them...

Hope this helps,

Patrik

Jun WANG's picture

Hi Patrik-
Thanks for your reply.

1. Is there any problem on the boudaries of adjacent surfaces as I have mentioned? Thanks.
2. In addtion, would you mind give me your sample codes? Thanks in advance.

Patrik Mueller's picture

Hi Jun,

1) I don't have the problem - but this could also be depeding on your data set. Perhaps you could also try another mesher like netgen?
2) Sorry - wouldn't make sense since I use software components outside OCCT...

Greets,

Patrik