DATAKIT SDK  V2026.4
ACIS 3D Write Sample
// TestLibSatWrite.cpp
// Sample demonstrating how to write ACIS SAT files using the Datakit ACIS writer (satw).
// Shows how to write a solid cube and an open shell body into a single .sat file.
#include "testwriters.h"
//DATAKIT headers needed
#include "datakit.h"
#include "satw/satw.hpp"
//! \brief Entry point: writes a solid cube and an open shell BRep body into a sample.sat (ACIS) file.
SatWriteSample( const Dtk_string &inResultDirectory )
{
Dtk_string outputFileName, outputDirectory;
std::cout << std::endl << "----------------------------------------------" << std::endl;
std::cout << "Acis Write start" << std::endl;
// Choosing output directory and file name
outputDirectory = inResultDirectory + L"Acis/";
outputDirectory.FixPathSeparator();
outputDirectory.mkdir();
outputFileName = outputDirectory + L"sample.sat";
// First you have to initialize the Sat writer
Dtk_ErrorStatus errorStatus = satw_InitFile( outputFileName );
if( errorStatus )
{
std::cout << "error : " << dtkTypeError( errorStatus ).c_str() << std::endl;
return errorStatus;
}
// We create 2 bodies
// We init the part
// We write the 2 bodies
satw_WriteBody( body1 );
satw_WriteBody( body2 );
// We close the part
// We free memory allocated for writing
std::cout << "=> " << outputFileName.c_str() << std::endl;
std::cout << "Acis Write end" << std::endl;
return dtkNoError;
}
//end_of_mainaciswrite
satw_InitPart
DtkErrorStatus satw_InitPart()
Initializes the writing of a 3D part.
satw.hpp
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
satw_InitFile
DtkErrorStatus satw_InitFile(const Dtk_string &inFileOut, const satw_WriteOptions &inOptions=satw_WriteOptions())
Initializes a file to be written.
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.
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
SatWriteSample
DtkErrorStatus SatWriteSample(const Dtk_string &inResultDirectory)
Entry point: writes a solid cube and an open shell BRep body into a sample.sat (ACIS) file.
Definition: testlibsatwrite.cpp:14
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
datakit.h
satw_EndPart
DtkErrorStatus satw_EndPart()
Ends the writing of a part.
testcreatecube.hpp
sampleWriter::CreateCube
Dtk_BodyPtr CreateCube()
Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex,...
Definition: testcreatecube.cpp:1325
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:151
satw_WriteBody
DtkErrorStatus satw_WriteBody(const Dtk_BodyPtr &inBody)
Writes a Body.
testwriters.h
sampleWriter::CreateOpenShell
Dtk_BodyPtr CreateOpenShell()
Creates an open shell body containing a single trimmed cylindrical surface (half cylinder,...
Definition: testcreatecube.cpp:1353
satw_EndFile
DtkErrorStatus satw_EndFile()
Ends the writing of the Sat file.