Serialization of TopoDs_Shape

Dear all,

We develop a 3D software linked to OCC v6.9 and we would like to use the v7.1 last release now.

We notice a big gap for the serialize issue between the two versions :

In the v6.9, we could directly serialize a TopoDs_Shape in a binary file just like that :

Writing method :

void CBRepGeometry::Store(CArchiveWriter& pWriter) const
{
    FSD_Archive             lOccAr      = FSD_Archive(&pWriter) ;
    Handle_ShapeSchema      occSchema   = BuildOcc<ShapeSchema>() ;
    Handle_Storage_Data     d           = BuildOcc<Storage_Data>() ;
    PTColStd_TransientPersistentMap aMap ;
    Handle_PTopoDS_HShape   aPShape     = MgtBRep::Translate(this->mShape, aMap, MgtBRep_WithoutTriangle) ;

    d->AddRoot("", aPShape) ;
    occSchema->Write(lOccAr, d) ;
}

 

Reading method :

void CBRepGeometry::Load(CArchiveReader& pReader)
{
    Handle_ShapeSchema          occSchema   = BuildOcc<ShapeSchema>() ;
    FSD_Archive                 ar          = FSD_Archive(&pReader) ;
    Handle_Storage_Data         d           = occSchema->Read(ar) ;
    Handle_Storage_HSeqOfRoot   roots       = d->Roots() ;
    Handle_Storage_Root         r           = roots->Value(1) ;
    Handle_Standard_Persistent  p           = r->Object() ;
    Handle_PTopoDS_HShape       aPShape     = Handle_PTopoDS_HShape::DownCast(p) ;

    // Create the shape
    PTColStd_PersistentTransientMap aMap ;

    MgtBRep::Translate(aPShape, aMap, this->mShape, MgtBRep_WithoutTriangle) ;

    this->SetShape(this->mShape) ;
}

 

These OCC objects do not exist anymore in OCC 7.1.

So please how is supported the retro-compatibility ?

And what is the current mecanism to do the job ?

I cannot find such an information in the OCC documentation.

 

Thanks in advance,

Jc

Forum supervisor's picture

Dear Jean-Charles,

You can refer to the section " Removal of legacy persistence" in Upgrade Guide:
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__upgrade.html#upgrade_700_persist

Please do not hesitate to communicate via our Contact Form for providing more information about our expertise, support and solutions and needs of your projects.

Best regards,
Forum supervisor

Richa Tiwari's picture

Please provide upgrade guide for ShapeSchema library.
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__upgrade.h... link is not working