how to load a csfdb file inside a document

Hi all,

is there a manner to load a .csfdb file inside a document?

I'm searching something similar to IGESCAFControl_Reader or STEPCAFControl_Reader.

Thanks in advance,
Francesco Argese

Marco Nanni's picture

Hello Francesco,

have a look in the sample import/export.

The tool is capable to import/export csfdb as well.

Cheers,

Marco.

Francesco Argese's picture

Hello Marco,

I've already seen in import/export sample but it shows only how to load a csfdb as a TopTools_HSequenceOfShape and not as a document.

I'm trying to load it in a document in order to have advantages of OCAF.

Francesco

Marco Nanni's picture

Hello Francesco,

In StdResoucce folder, there is nothing about such file extension (no schema and no storage/retrival drivers guid).

I believe there is no provided application able to load it as document, but I am no so much expert to give you a final advice.

Marco.

Patrik Mueller's picture

Hi,

here's a snippet sample. I use it to transfer the data after reading the csfdb file. Hope it helps:

bool XDEImporterCSFDB::Transfer(Handle_TDocStd_Document theDocument)
{
bool result = BaseXDEImporter::Transfer(theDocument);
if (result)
{
if (!m_pStorageData.IsNull())
{
Handle(Storage_HSeqOfRoot) roots = m_pStorageData->Roots();
Handle(Standard_Persistent) p;
Handle(Storage_Root) r;
Handle(PTopoDS_HShape) aPShape;

Handle (XCAFDoc_ShapeTool) rootAssembly = XCAFDoc_DocumentTool::ShapeTool (theDocument->Main());
//Handle (XCAFDoc_ColorTool) colors = XCAFDoc_DocumentTool::ColorTool (theDocument->Main());
Handle (XCAFDoc_LayerTool) layers = XCAFDoc_DocumentTool::LayerTool (theDocument->Main());
TDF_Label layerLabel = layers->AddLayer("Base_Layer");

//Quantity_Color Col (Quantity_NOC_NAVYBLUE/*Quantity_NOC_GRAY18*/);
//XCAFDoc_ColorType ctype = XCAFDoc_ColorGen;

int nbEntries = roots->Length();

for (int i = 1; i <= nbEntries ; i++ )
{
r = roots->Value(i);

p = r->Object();

aPShape = Handle(PTopoDS_HShape)::DownCast(p);

if ( !aPShape.IsNull() )
{
PTColStd_PersistentTransientMap aMap;
TopoDS_Shape aTShape;
MgtBRep::Translate(aPShape,aMap,aTShape, MgtBRep_WithTriangle);
if (!aTShape.IsNull())
{
TDF_Label aLabel = rootAssembly->AddShape(aTShape, false);
TDataStd_Name::Set (aLabel, r->Name());

//colors->SetColor ( aLabel, Col, ctype );

layers->SetLayer(aLabel, layerLabel);

}
}
}
AddDefaultMaterialForEmptyMaterialList(theDocument); // add a color

Greets,

Patrik