DATAKIT SDK  V2026.4
testlibsatwrite.cpp File Reference

Functions

DtkErrorStatus SatWriteSample (const Dtk_string &inResultDirectory)
 Entry point: writes a solid cube and an open shell BRep body into a sample.sat (ACIS) file. More...
 

Function Documentation

◆ 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.

15 {
16  Dtk_string outputFileName, outputDirectory;
17 
18  std::cout << std::endl << "----------------------------------------------" << std::endl;
19  std::cout << "Acis Write start" << std::endl;
20 
21  // Choosing output directory and file name
22  outputDirectory = inResultDirectory + L"Acis/";
23  outputDirectory.FixPathSeparator();
24  outputDirectory.mkdir();
25  outputFileName = outputDirectory + L"sample.sat";
26 
27  // First you have to initialize the Sat writer
28  Dtk_ErrorStatus errorStatus = satw_InitFile( outputFileName );
29 
30  if( errorStatus )
31  {
32  std::cout << "error : " << dtkTypeError( errorStatus ).c_str() << std::endl;
33  return errorStatus;
34  }
35 
36  // We create 2 bodies
39 
40  // We init the part
41  satw_InitPart();
42 
43  // We write the 2 bodies
44  satw_WriteBody( body1 );
45  satw_WriteBody( body2 );
46 
47  // We close the part
48  satw_EndPart();
49 
50  // We free memory allocated for writing
51  satw_EndFile();
52  std::cout << "=> " << outputFileName.c_str() << std::endl;
53  std::cout << "Acis Write end" << std::endl;
54 
55  return dtkNoError;
56 }
satw_InitPart
DtkErrorStatus satw_InitPart()
Initializes the writing of a 3D part.
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.
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
satw_EndPart
DtkErrorStatus satw_EndPart()
Ends the writing of a part.
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.
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.