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.
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...
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.
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...
Wed, 01/21/2009 - 02:49
co-ask ???
Wed, 01/21/2009 - 03:16
Hi,
take a look at the ImportExport sample - it should contain all needed infos...
Greets,
Patrik
Thu, 02/26/2009 - 21:33
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 ???
Fri, 02/27/2009 - 10:05
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
Mon, 03/02/2009 - 10:46
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.
Wed, 03/11/2009 - 12:14
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