Save an OCAF document

Hi, I am a developer and I am doing a example that save an OCAF document. I saw in other post that I have to configure the file Resources but how I have to configure the file Plugins.

JuryS's picture

Sample of Plugin file:

! Some drivers
!
a148e300-5740-11d1-a904-080036aaa103.Location: PluginFWOS
!
! STD driver
!
ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PluginStd
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: PluginStd
ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PluginStd
!
! STD Lite
!
bd696000-5b34-11d1-b5ba-00a0c9064368.Location: PluginStdL
bd696001-5b34-11d1-b5ba-00a0c9064368.Location: PluginStdL
bd696002-5b34-11d1-b5ba-00a0c9064368.Location: PluginStdL
!
! XML Lite
!
13a56820-8269-11d5-aab2-0050044b1af1.Location: PluginXmlL
13a56822-8269-11d5-aab2-0050044b1af1.Location: PluginXmlL
!
! Bin OCAF
!
03a56835-8269-11d5-aab2-0050044b1af1.Location: PluginBin
03a56836-8269-11d5-aab2-0050044b1af1.Location: PluginBin
!
! Bin Light
!
13a56835-8269-11d5-aab2-0050044b1af1.Location: PluginBinL
13a56836-8269-11d5-aab2-0050044b1af1.Location: PluginBinL
!
! XCAF
!
ed8793f8-3142-11d4-b9b5-0060b0ee281b.Location: PluginXCAF
ed8793f9-3142-11d4-b9b5-0060b0ee281b.Location: PluginXCAF
ed8793fa-3142-11d4-b9b5-0060b0ee281b.Location: PluginXCAF
!
! XML
!
f78ff496-a779-11d5-aab4-0050044b1af1.Location: PluginXmlXCAF
f78ff497-a779-11d5-aab4-0050044b1af1.Location: PluginXmlXCAF
!
! XML XCAF
!
a78ff496-a779-11d5-aab4-0050044b1af1.Location: PluginBinXCAF
a78ff497-a779-11d5-aab4-0050044b1af1.Location: PluginBinXCAF

Sample of Resources:

formatlist:MDTV-Standard MDTV-XCAF XmlXCAF BinXCAF BinOcaf OCC-StdLite BinLOcaf XmlLOcaf

MDTV-Standard.Description: Standard Document Version 1.0
MDTV-Standard.FileExtension: std
MDTV-Standard.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
MDTV-Standard.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368
MDTV-StandardSchema: ad696002-5b34-11d1-b5ba-00a0c9064368

MDTV-XCAF.Description: XCAF Document Version 1.0
MDTV-XCAF.FileExtension: dxc
MDTV-XCAF.StoragePlugin: ed8793f8-3142-11d4-b9b5-0060b0ee281b
MDTV-XCAF.RetrievalPlugin: ed8793f9-3142-11d4-b9b5-0060b0ee281b
MDTV-XCAFSchema: ed8793fa-3142-11d4-b9b5-0060b0ee281b

XmlXCAF.Description: XmlXCAF Document Version 1.0
XmlXCAF.FileExtension: xml
XmlXCAF.StoragePlugin: f78ff496-a779-11d5-aab4-0050044b1af1
XmlXCAF.RetrievalPlugin: f78ff497-a779-11d5-aab4-0050044b1af1

BinXCAF.Description: BinXCAF Document Version 1.0
BinXCAF.FileExtension: xbf
BinXCAF.StoragePlugin: a78ff496-a779-11d5-aab4-0050044b1af1
BinXCAF.RetrievalPlugin: a78ff497-a779-11d5-aab4-0050044b1af1

BinOcaf.Description: Bin Ocaf Document Version 1.0
BinOcaf.FileExtension: cbf
BinOcaf.StoragePlugin: 03a56835-8269-11d5-aab2-0050044b1af1
BinOcaf.RetrievalPlugin: 03a56836-8269-11d5-aab2-0050044b1af1

OCC-StdLite.Description: Lite Document Version 1.0
OCC-StdLite.FileExtension: stdl
OCC-StdLite.StoragePlugin: bd696000-5b34-11d1-b5ba-00a0c9064368
OCC-StdLite.RetrievalPlugin: bd696001-5b34-11d1-b5ba-00a0c9064368
OCC-StdLiteSchema: bd696002-5b34-11d1-b5ba-00a0c9064368

BinLOcaf.Description: Lite Bin Ocaf Document Version 1.0
BinLOcaf.FileExtension: cbfl
BinLOcaf.StoragePlugin: 13a56835-8269-11d5-aab2-0050044b1af1
BinLOcaf.RetrievalPlugin: 13a56836-8269-11d5-aab2-0050044b1af1

XmlLOcaf.Description: Lite Xml Document Version 1.0
XmlLOcaf.FileExtension: xmll
XmlLOcaf.StoragePlugin: 13a56820-8269-11d5-aab2-0050044b1af1
XmlLOcaf.RetrievalPlugin: 13a56822-8269-11d5-aab2-0050044b1af1

JuryS's picture

Also you must install the system environments for this files, something like this:

qputenv("CSF_ResourcesDefaults",resdir.toAscii());
qputenv("CSF_PluginDefaults",resdir.toAscii());

Then you are need to create some class of AppStd_Application and put all of this formats here.
After when your application is loading with MainWindow, for the sample, you need to start your class something like :
myOcafApp = new AppStd_Application();
and get any data from this class (that is child of AppStd_Application),
create doc, something like OcafApp->NewDocument("MDTV-Standard",myOCAFDoc);

define the viewer, something like :

TPrsStd_AISViewer::New(myOCAFDoc->Main(),myViewer);
myContext = new AIS_InteractiveContext(myViewer);
TPrsStd_AISViewer::Find(myOCAFDoc->Main(), myContext);

set undo limit: myOCAFDoc->SetUndoLimit(10);
change storage format before save document:
myOCAFDoc->ChangeStorageFormat(TCollection_ExtendedString("MDTV-Standard"));

There is more virtual functions and classes, write here if something wrong in your application;

Gilles DAVID's picture

Thanks for your reply. I did all those steps and the method SaveAs return CFD_SS_Failure. what that means?

Forum supervisor's picture

Dear David,
You may overlook also paragraph "4. 3 The Document" of OCAF User's Guide.
Regards