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

Am I able to restrict not to write Points data in IGES file while writing?

suman's picture
Forums: 

Hi...
I am in a need of converting an STL file to IGES file.I'm able to do it.I'm getting the points init by using write() function in IGESContrl_Writer class.But I don't want to write the points data into the IGES file.How can I do it?
Can you please help me to do it???

Thanks in Advance
--suman

suman's picture

Hi...
I am in a need of converting an STL file to IGES file.I'm able to do it.I'm getting the points init by using write() function in IGESContrl_Writer class.But I don't want to write the points data into the IGES file.How can I do it?
Can you please help me to do it???

Thanks in Advance
--suman

Roman Lygin's picture

Suman,
IGESControl_Writer accepts TopoDS_Shape. Make sure that your shape (likely TopoDS_Compound) does not contain 'floating' vertices, i.e. those not belonging to edges. This will ensure that you do not write explicit point entities into IGES. If I'm getting this incorrectly then I am more more than confused of what you mean ;-)

Roman
---
opencascade.blogspot.com - the Open CASCADE blog

suman's picture

Hi Roman,
Thanks for your reply....
I'm very sorry If You are struggling to understand my english......
Actually I am calling the SaveIGES(InteractiveContext) to save the file in the editor as IGES file.....But I'm getting points data also in that IGES file...
But I don't want to have points data in that file...
The function to read a file and convert it into shape is as follows...
void AppDoc::Read(TopoDS_Shape& aShape, const Standard_CString aFileName)
{
OSD_Path aFile(aFileName);

Handle(StlMesh_Mesh) aSTLMesh = RWStl::ReadFile(aFile);
Standard_Integer NumberDomains = aSTLMesh->NbDomains();
Standard_Integer iND;
gp_XYZ p1, p2, p3;
TopoDS_Vertex Vertex1, Vertex2, Vertex3;
TopoDS_Face AktFace;
TopoDS_Wire AktWire;
BRepBuilderAPI_Sewing aSewingTool;
Standard_Real x1, y1, z1;
Standard_Real x2, y2, z2;
Standard_Real x3, y3, z3;

aSewingTool.Init(1.0e-06,Standard_True);

TopoDS_Compound aComp;
BRep_Builder BuildTool;
BuildTool.MakeCompound( aComp );

StlMesh_MeshExplorer aMExp (aSTLMesh);

for (iND=1;iND {
for (aMExp.InitTriangle (iND); aMExp.MoreTriangle (); aMExp.NextTriangle ())
{
aMExp.TriangleVertices (x1,y1,z1,x2,y2,z2,x3,y3,z3);
p1.SetCoord(x1,y1,z1);
p2.SetCoord(x2,y2,z2);
p3.SetCoord(x3,y3,z3);

if ((!(p1.IsEqual(p2,0.0))) && (!(p1.IsEqual(p3,0.0))))
{
Vertex1 = BRepBuilderAPI_MakeVertex(p1);
Vertex2 = BRepBuilderAPI_MakeVertex(p2);
Vertex3 = BRepBuilderAPI_MakeVertex(p3);

AktWire = BRepBuilderAPI_MakePolygon( Vertex1, Vertex2, Vertex3, Standard_True);

if( !AktWire.IsNull())
{
AktFace = BRepBuilderAPI_MakeFace( AktWire);
if(!AktFace.IsNull())
BuildTool.Add( aComp, AktFace );//Adding only faces
}
}
}
}
aSTLMesh->Clear();

aSewingTool.Load( aComp );
aSewingTool.Perform();
aShape = aSewingTool.SewedShape();
if ( aShape.IsNull() )
aShape = aComp;
}

In the above code I'm adding only faces to TopoDS_Compound. Eventhough the vertices data is writing into IGES file....

Please can you help me to write the data without vertices data...

Thanks
--suman

Roman Lygin's picture

Hi Suman,

I don't get your concern. How do you expect your face data be written otherwise ? You convert your linear edges into IGES Line entity (Type110) which refers to the Parametric section storing its start and end vertices. Obviously this exactly matches your original STL points. What's wrong with that ?

By the way, do you really need sewing ? If you never use your body as a shell and store faces into Trimmed Surfaces (IGES type 144) connectivity is lost anyway. Thus, using BRepBuilderAPI_Sewing is just waste of time.

Hope this helps.
Roman
---
opencascade.blogspot.com - the Open CASCADE blog