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

dump a line shape into a file

Gan Lu's picture

Hi all, I\'m try to do a simple test, which builds a line through 2 points and then dump it into a file, named \'EdgeData\', as follows:
gp_Pnt aPnt1(0,0,0);
gp_Pnt aPnt2(1,1,0);
Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1 , aPnt2);

TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);

FSD_File f;
ShapeSchema *ssche = new ShapeSchema;

f.Open(\"EdgeData\", Storage_VSWrite);
PTColStd_TransientPersistentMap aMap;
Handle(PTopoDS_HShape) aPShape= MgtBRep::Translate(aEdge1, aMap, MgtBRep_WithoutTriangle);
Handle(Storage_Data) d= new Storage_Data;
d->AddRoot(\"ObjectName\", aPShape);

But it has a segment fault, and the error comes from the line ssche->Write(f,d). Can anyone please suggest how to solve it?

Many Thanks

Gan Lu's picture

Hi, the problem has been solved... I should define the ShapeSchema as: Handle(ShapeSchema) ssche = new ShapeSchema;
But what the format of the output file is it? My intention is to get the interpreted points and perhaps I can plot it through gnuplot.