DATAKIT API  V2025.1
Get Started

Enable the readers you need
Start Dtk_API
Open a Dtk_MainDoc from any format

Enable the readers you need

//*********************************************************************************************************
//
//
//********************************************************************************************************
#include "datakit.h"
using namespace std;
//If you want to link with libraries using pskernel
//#define USE_PSKERNEL
{
// Supported Format : extensions
//Acis : sat
//Catiav4 : model (both 2d and 3d) session, dlv
//Catiav5 : CATDrawing,CATPart,CATProduct
//Cgr : cgr
//Dwg : dwg
//Iges : igs,iges
//Inventor : ipt,iam
//Jt : jt
//Parasolid : x_t,x_b,xmt
//Proe : prt,asm
//Solidedge : par,asm
//Solidworks : sldprt,sldasm
//Step : step,stp
//Unigraphics: prt (both 2d and 3d)
//Vda : vda
//First You have to Enable the readers you want to use
#ifndef Linux
#endif
#ifndef CENTOS
#endif
#ifdef USE_PSKERNEL
#else
#endif
}
//Set the Schema directory needed for readers based on Pskernel (UG, Solidworks, Solidedge), or CADDS
{
Dtk_ErrorStatus SchemaStatus;
Dtk_string SchemaDirectory = "./Schema";
//Set the Schema directory needed for readers based on Pskernel (UG, Solidworks, Solidedge), or CADDS
#ifndef Linux
char TmpFullPathSchemaDir[_MAX_PATH];
if (_fullpath(TmpFullPathSchemaDir, SchemaDirectory.c_str(), _MAX_PATH) != NULL)
SchemaStatus = inoutMyApi->SetSchemaDir(TmpFullPathSchemaDir);
else
SchemaStatus = inoutMyApi->SetSchemaDir(SchemaDirectory);
#else
SchemaStatus = inoutMyApi->SetSchemaDir(SchemaDirectory);
#endif
#ifdef USE_PSKERNEL
if (SchemaStatus != dtkNoError)
{
cout <<"Schema Directory error -needed for readers based on Pskernel (UG, Solidworks, Solidedge), or CADDS- : " << dtkTypeError(SchemaStatus).c_str() << endl;
}
#endif
return SchemaStatus;
}

Start Dtk_API

Open a Dtk_MainDoc from any format

//*********************************************************************************************************
// This Sample reads input file via Datakit API and create pdf output file in same directory as input file
// It can optionally generate a dump of the input file into xml format
//********************************************************************************************************
#include "datakit.h"
#include "../../WritingSample/PdfWrite/PdfWrite.hpp"
#include "../../WritingSample/XmlWrite/XmlWrite.hpp"
#include "../ThroughAssemblies/WriteComponent.hpp"
using namespace std;
//This function allow you to read a file from any format
Dtk_ErrorStatus ProcessCADFile( const Dtk_string& inInputFile, const Dtk_string &inOutputFolder)
{
// You Get the current API
Dtk_API * MyAPI = Dtk_API::GetAPI();
cout << "Processing file " << inInputFile.c_str() << endl;
Dtk_string FileVersion;
stError = MyAPI->GetFileVersion(inInputFile, FileVersion);
if( FileVersion.is_not_NULL() )
cout <<"File version = " << FileVersion.c_str() << endl;
if (stError != dtkNoError)
{
cout << "Error with file version: " << dtkTypeError( stError ).c_str() << endl;
return stError;
}
//If you want to get a log file for reader (inventory, missing files in assembly...) you have to set it
MyAPI->SetLogFile( "DtkLogFile.txt" );
//Following Project Options
// To Write an Xml file
{
stErrorXml = XmlWriteInit( inInputFile, inOutputFolder );
}
// To Write an PDF file
{
stErrorPdf = PdfInitWrite( inInputFile, inOutputFolder );
}
//You Open the file you want to read and get corresponding Document
Dtk_ErrorStatus err = MyAPI->OpenDocument( inInputFile, TmpDoc );
//If no Error we write the Document
if( err == dtkNoError && TmpDoc.IsNotNULL() )
{
WriteDocument( TmpDoc ); //see WriteDocument.cpp
}
else
{
cout << "Error OpenDocument: " << err << dtkTypeError( err ).c_str() << endl;
}
//We close the opened document
err = MyAPI->EndDocument( TmpDoc );
{
}
{
PdfEndWrite( inInputFile );
}
return err;
}
ObjReader::Enable
static Dtk_bool Enable()
Dtk_API::EndDocument
Dtk_ErrorStatus EndDocument(Dtk_MainDocPtr &inoutDocument)
Close a Document.
CgrReader::Enable
static Dtk_bool Enable()
SmgReader::Enable
static Dtk_bool Enable()
NavisReader::Enable
static Dtk_bool Enable()
LavaReader::Enable
static Dtk_bool Enable()
JtReader::Enable
static Dtk_bool Enable()
CgmReader::Enable
static Dtk_bool Enable()
GltfReader::Enable
static Dtk_bool Enable()
StlReader::Enable
static Dtk_bool Enable()
Dtk_SmartPtr::IsNotNULL
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
SwReader::Enable
static Dtk_bool Enable()
_3dmReader::Enable
static Dtk_bool Enable()
CerconReader::Enable
static Dtk_bool Enable()
F3dReader::Enable
static Dtk_bool Enable()
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
WriteDocument
Dtk_ErrorStatus WriteDocument(Dtk_MainDocPtr inDocument)
Definition: WriteDocument.cpp:12
PlmXmlReader::Enable
static Dtk_bool Enable()
XmlWriteInit
Dtk_ErrorStatus XmlWriteInit(Dtk_string inInputFile, const Dtk_string &inOutputFolder)
Definition: XmlWrite.cpp:22
CatiaV4Reader::Enable
static Dtk_bool Enable()
StepReader::Enable
static Dtk_bool Enable()
Dtk_API::OpenDocument
Dtk_ErrorStatus OpenDocument(const Dtk_string &inInputFile, Dtk_MainDocPtr &outDocument)
Open a Document (call EndDocument to close it)
RevitReader::Enable
static Dtk_bool Enable()
Dtk_API::SetSchemaDir
Dtk_ErrorStatus SetSchemaDir(const Dtk_string &inSchemaDir)
Set Schema Directory needed for Unigraphics, Parasolid, Solidedge, Solidworks and Jt readers.
ProeReader::Enable
static Dtk_bool Enable()
CaddsReader::Enable
static Dtk_bool Enable()
DwgReader::Enable
static Dtk_bool Enable()
InvReader::Enable
static Dtk_bool Enable()
ProCeraReader::Enable
static Dtk_bool Enable()
Dtk_string::is_not_NULL
Dtk_bool is_not_NULL() const
UgReader::Enable
static Dtk_bool Enable()
Dtk_API::GetAPI
static Dtk_API * GetAPI()
Get DATAKIT API.
EnableReaders
void EnableReaders()
Definition: EnableReaders.cpp:12
CatiaV5Reader::Enable
static Dtk_bool Enable()
PdfEndWrite
void PdfEndWrite(const Dtk_string &inInputFile)
Definition: PdfWrite.cpp:80
IgesReader::Enable
static Dtk_bool Enable()
CatiaV6Reader::Enable
static Dtk_bool Enable()
XmlWriteEnd
Dtk_ErrorStatus XmlWriteEnd()
Definition: XmlWrite.cpp:39
IfcReader::Enable
static Dtk_bool Enable()
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
DcmReader::Enable
static Dtk_bool Enable()
PsReader::Enable
static Dtk_bool Enable()
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
dtkTypeError
Dtk_string dtkTypeError(Dtk_Int32 errNumero)
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
CerecReader::Enable
static Dtk_bool Enable()
ComponentProcessed
Dtk_tab< Dtk_ID > ComponentProcessed
Definition: WritePrototype.cpp:12
CreoviewReader::Enable
static Dtk_bool Enable()
datakit.h
ProcessCADFile
Dtk_ErrorStatus ProcessCADFile(const Dtk_string &inInputFile, const Dtk_string &inOutputFolder)
Definition: OpenDocument.cpp:18
XmtReader::Enable
static Dtk_bool Enable()
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:85
FbxReader::Enable
static Dtk_bool Enable()
SetSchemaDirectory
Dtk_ErrorStatus SetSchemaDirectory(Dtk_API *inoutMyApi)
Definition: EnableReaders.cpp:78
IsXmlDumpActivated
Dtk_bool IsXmlDumpActivated()
Definition: XmlWrite.cpp:17
PdfInitWrite
Dtk_ErrorStatus PdfInitWrite(const Dtk_string &inInputFileName, const Dtk_string &inOutputFolder)
Definition: PdfWrite.cpp:31
Dtk_API::GetFileVersion
Dtk_ErrorStatus GetFileVersion(const Dtk_string &inInputFile, Dtk_string &outVersion)
Independant method to get version of inInputFile.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:140
VdaReader::Enable
static Dtk_bool Enable()
SolidEdgeReader::Enable
static Dtk_bool Enable()
QifReader::Enable
static Dtk_bool Enable()
Dtk_API::SetLogFile
Dtk_ErrorStatus SetLogFile(const Dtk_string &inLogFile)
Set Log File.
IsPdfDumpActivated
Dtk_bool IsPdfDumpActivated()
Definition: PdfWrite.cpp:26
Dtk_API
Definition: dtk_api.hpp:75
AcisReader::Enable
static Dtk_bool Enable()