Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

how to load a csfdb file inside a document

how to load a csfdb file inside a document
Francesco Argese 2012/06/04 20:18
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 2012/06/04 21:10
Hello Francesco,

have a look in the sample import/export.

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

Cheers,

Marco.
Francesco Argese 2012/06/05 16:39
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 2012/06/05 18:10
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 2012/06/06 10:29
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
 
 
Latest news
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map