 |
DATAKIT SDK
V2026.4
|
|
◆ ActivatePsMemory()
| void ActivatePsMemory |
( |
bool |
inActivate | ) |
|
◆ ActivatePsSession()
| void ActivatePsSession |
( |
bool |
inActivate | ) |
|
◆ ActivatePsTraverse()
| void ActivatePsTraverse |
( |
bool |
inActivate | ) |
|
◆ EnumerateBodiesInSession()
| void EnumerateBodiesInSession |
( |
| ) |
|
149 PK_PARTITION_t partition = 0;
150 PK_SESSION_ask_curr_partition( &partition );
153 PK_BODY_t* bodies =
nullptr;
154 PK_PARTITION_ask_bodies( partition, &nBodies, &bodies );
155 cout <<
"Bodies in active partition: " << nBodies << endl;
157 for(
int i = 0; i < nBodies; ++i )
159 PK_BODY_t body = bodies[ i ];
161 PK_BODY_type_t bodyType = 0;
162 PK_BODY_ask_type( body, &bodyType );
165 PK_FACE_t* faces =
nullptr;
166 PK_ERROR_code_t fErr = PK_BODY_ask_faces( body, &nFaces, &faces );
168 const char* typeName =
"unknown";
169 if ( bodyType == PK_BODY_type_solid_c ) typeName =
"solid";
170 else if( bodyType == PK_BODY_type_sheet_c ) typeName =
"sheet";
171 else if( bodyType == PK_BODY_type_wire_c ) typeName =
"wire";
172 else if( bodyType == PK_BODY_type_acorn_c ) typeName =
"acorn";
173 else if( bodyType == PK_BODY_type_general_c ) typeName =
"general";
175 if( fErr == PK_ERROR_none )
177 cout <<
" Body[" << i <<
"] tag=" << body
178 <<
" type=" << typeName
179 <<
" faces=" << nFaces << endl;
180 if( faces ) PK_MEMORY_free( faces );
184 cout <<
" Body[" << i <<
"] tag=" << body
185 <<
" type=" << typeName
186 <<
" PK_BODY_ask_faces error=" << fErr << endl;
190 if( bodies ) PK_MEMORY_free( bodies );
◆ IsPsMemoryActivated()
| bool IsPsMemoryActivated |
( |
| ) |
|
◆ IsPsSessionActivated()
| bool IsPsSessionActivated |
( |
| ) |
|
◆ IsPsTraverseActivated()
| bool IsPsTraverseActivated |
( |
| ) |
|
◆ LoadBodiesIntoPsSession()
| void LoadBodiesIntoPsSession |
( |
const Dtk_string & |
inXtFile | ) |
|
200 cout <<
"\n--- Parasolid session: loading \""
201 << inXtFile.
c_str() <<
"\" from disk ---" << endl;
206 PK_PART_receive_o_t recvOpts;
207 PK_PART_receive_o_m( recvOpts );
210 PK_PART_t* parts =
nullptr;
211 PK_ERROR_code_t pkErr = PK_PART_receive(
212 inXtFile.
c_str(), &recvOpts, &nParts, &parts );
214 if( pkErr != PK_ERROR_none )
216 cout <<
"PK_PART_receive failed, error code: " << pkErr << endl;
220 cout <<
"PK_PART_receive: " << nParts <<
" part(s) received." << endl;
224 if( parts ) PK_MEMORY_free( parts );
227 cout <<
"--- Parasolid session closed ---" << endl;
◆ LoadBodiesIntoPsSessionFromStream()
| void LoadBodiesIntoPsSessionFromStream |
( |
const Dtk_tab< char > & |
inStream | ) |
|
238 if( inStream.
size() == 0 )
240 cout <<
"Warning: in-memory stream is empty, nothing to load." << endl;
244 cout <<
"\n--- Parasolid session: loading "
245 << inStream.
size() <<
" bytes from in-memory stream ---" << endl;
251 PK_MEMORY_block_t block;
252 block.next =
nullptr;
253 block.n_bytes =
static_cast<size_t>( inStream.
size() );
254 block.bytes = &inStream[ 0 ];
256 PK_PART_receive_o_t recvOpts;
257 PK_PART_receive_o_m( recvOpts );
260 PK_PART_t* parts =
nullptr;
261 PK_ERROR_code_t pkErr = PK_PART_receive_b( block, &recvOpts, &nParts, &parts );
263 if( pkErr != PK_ERROR_none )
265 cout <<
"PK_PART_receive_b failed, error code: " << pkErr << endl;
269 cout <<
"PK_PART_receive_b: " << nParts <<
" part(s) received." << endl;
273 if( parts ) PK_MEMORY_free( parts );
276 cout <<
"--- Parasolid session closed ---" << endl;
◆ PsErrorHandler()
| static PK_ERROR_code_t PsErrorHandler |
( |
PK_ERROR_sf_t * |
error_sf | ) |
|
|
static |
56 return error_sf->code;
◆ ReceiveBodiesIntoCurrentPsSession()
| void ReceiveBodiesIntoCurrentPsSession |
( |
const Dtk_string & |
inXtFile | ) |
|
292 cout <<
"\n--- Receiving \""
294 <<
"\" into existing Parasolid session ---" << endl;
296 PK_PART_receive_o_t recvOpts;
297 PK_PART_receive_o_m( recvOpts );
300 PK_PART_t* parts =
nullptr;
301 PK_ERROR_code_t pkErr = PK_PART_receive(
302 inXtFile.
c_str(), &recvOpts, &nParts, &parts );
304 if( pkErr != PK_ERROR_none )
306 cout <<
"PK_PART_receive failed, error code: " << pkErr << endl;
309 cout <<
"PK_PART_receive: " << nParts <<
" part(s) received." << endl;
311 if( parts ) PK_MEMORY_free( parts );
◆ ReceiveBodiesIntoCurrentPsSessionFromStream()
| void ReceiveBodiesIntoCurrentPsSessionFromStream |
( |
const Dtk_tab< char > & |
inStream | ) |
|
321 if( inStream.
size() == 0 )
323 cout <<
"Warning: in-memory stream is empty, nothing to receive." << endl;
327 cout <<
"\n--- Receiving "
329 <<
" bytes from in-memory stream into existing Parasolid session ---" << endl;
331 PK_MEMORY_block_t block;
332 block.next =
nullptr;
333 block.n_bytes =
static_cast<size_t>( inStream.
size() );
334 block.bytes = &inStream[ 0 ];
336 PK_PART_receive_o_t recvOpts;
337 PK_PART_receive_o_m( recvOpts );
340 PK_PART_t* parts =
nullptr;
341 PK_ERROR_code_t pkErr = PK_PART_receive_b( block, &recvOpts, &nParts, &parts );
343 if( pkErr != PK_ERROR_none )
345 cout <<
"PK_PART_receive_b failed, error code: " << pkErr << endl;
348 cout <<
"PK_PART_receive_b: " << nParts <<
" part(s) received." << endl;
350 if( parts ) PK_MEMORY_free( parts );
◆ ReceiveBodyFromTempFile()
| static void ReceiveBodyFromTempFile |
( |
const char * |
inData, |
|
|
Dtk_Size_t |
inDataSize, |
|
|
const string & |
inIndent |
|
) |
| |
|
static |
370 tempFile += L
"dtk_ps_traverse.x_b";
376 cout << inIndent <<
" Error: cannot write temp file "
377 << tempFile.
c_str() << endl;
380 fwrite( inData,
sizeof(
char),
static_cast<size_t>( inDataSize ), fp );
386 PK_PART_receive_o_t partOpts;
387 PK_PART_receive_o_m( partOpts );
388 partOpts.transmit_format = PK_transmit_format_binary_c;
390 PK_PARTITION_receive_o_t partitionOpts;
391 PK_PARTITION_receive_o_m( partitionOpts );
392 partitionOpts.transmit_format = PK_transmit_format_binary_c;
395 PK_PART_t* parts =
nullptr;
397 PK_ERROR_code_t pkErr = PK_PART_receive(
398 realName.
c_str(), &partOpts, &nParts, &parts );
400 if( pkErr == PK_ERROR_corrupt_file )
403 PK_PARTITION_t partition = 0;
404 pkErr = PK_PARTITION_receive(
405 realName.
c_str(), &partitionOpts, &partition );
406 if( pkErr == PK_ERROR_none && partition > 0 )
407 pkErr = PK_PARTITION_ask_bodies( partition, &nParts,
408 (PK_BODY_t**)&parts );
413 if( pkErr == PK_ERROR_none )
414 cout << inIndent <<
" -> " << nParts
415 <<
" body/bodies added to session." << endl;
417 cout << inIndent <<
" -> PK_PART_receive error: " << pkErr << endl;
419 if( parts ) PK_MEMORY_free( parts );
◆ SetPSchema()
| static void SetPSchema |
( |
| ) |
|
|
static |
68 char fullPath[ _MAX_PATH ];
69 if( _fullpath( fullPath,
"./Schema", _MAX_PATH ) !=
nullptr )
72 static wchar_t schEnvW[ 2048 ];
73 swprintf( schEnvW, 2047, L
"P_SCHEMA=%s", schemaDir.w_str() );
76 static char schEnvA[ 2048 ];
77 snprintf( schEnvA,
sizeof(schEnvA),
"P_SCHEMA=%s", schemaDir.
c_str() );
◆ StartPsSession()
| static void StartPsSession |
( |
| ) |
|
|
static |
89 PK_SESSION_frustrum_t frustrum;
90 PK_SESSION_frustrum_o_m( frustrum );
91 frustrum.fstart = FSTART;
92 frustrum.fabort = FABORT;
93 frustrum.fstop = FSTOP;
94 frustrum.fmallo = FMALLO;
95 frustrum.fmfree = FMFREE;
96 frustrum.ffoprd = FFOPRD;
97 frustrum.ffopwr = FFOPWR;
98 frustrum.ffclos = FFCLOS;
99 frustrum.ffread = FFREAD;
100 frustrum.ffwrit = FFWRIT;
101 frustrum.goopsg = GOOPSG;
102 frustrum.goclsg = GOCLSG;
103 frustrum.gosgmt = GOSGMT;
104 PK_SESSION_register_frustrum( &frustrum );
106 PK_SESSION_start_o_t sessionOpts;
107 PK_SESSION_start_o_m( sessionOpts );
108 sessionOpts.user_field = 16;
109 PK_SESSION_start( &sessionOpts );
111 PK_ERROR_frustrum_t errFrustrum;
113 PK_ERROR_register_callbacks( errFrustrum );
115 PK_SESSION_set_journalling( PK_LOGICAL_true );
116 PK_SESSION_set_check_self_int( PK_LOGICAL_false );
117 PK_SESSION_set_check_continuity( PK_LOGICAL_false );
119 PK_SESSION_kernel_version_t ver;
120 if( PK_SESSION_ask_kernel_version( &ver ) == PK_ERROR_none )
121 cout <<
"PsKernel version: "
122 << ver.major_revision <<
"."
123 << ver.minor_revision <<
"."
124 << ver.build_number << endl;
◆ StartSharedPsSession()
| void StartSharedPsSession |
( |
| ) |
|
◆ StopPsSession()
| static void StopPsSession |
( |
| ) |
|
|
static |
◆ StopSharedPsSession()
| void StopSharedPsSession |
( |
| ) |
|
◆ TraverseNodeBodiesFromStream()
| static void TraverseNodeBodiesFromStream |
( |
Dtk_NodePtr |
inNode, |
|
|
int |
inDepth |
|
) |
| |
|
static |
430 if( inNode.
IsNULL() )
return;
432 int blanked = inNode->GetInfos()->GetBlankedStatus();
441 string indent(
static_cast<size_t>( inDepth ) * 2,
' ' );
445 && inNode->GetInfos()->GetInfiniteGeometryFlag() == 0
452 if( body->info().
IsNotNULL() ) name = body->info()->GetName();
462 const char* data = stream->GetBinaryContent();
463 const Dtk_Size_t dataSize = stream->GetBinaryContentSize();
465 cout << indent <<
"[Body]";
466 if( name.
len() > 0 ) cout <<
" \"" << name.
c_str() <<
"\"";
467 cout <<
" stream=" << dataSize <<
" B" << endl;
476 cout << indent <<
"[Body]";
477 if( name.
len() > 0 ) cout <<
" \"" << name.
c_str() <<
"\"";
478 cout <<
" (no Parasolid stream, skipped)" << endl;
◆ s_psMemoryActivated
| bool s_psMemoryActivated = false |
|
static |
◆ s_psSessionActivated
| bool s_psSessionActivated = false |
|
static |
◆ s_psTraverseActivated
| bool s_psTraverseActivated = false |
|
static |
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
NodeDataTypeEnum PrimaryType() const
Definition: dtk_maindoc.hpp:285
This is a high level string class.
Definition: dtk_string.hpp:53
size_t Dtk_Size_t
Definition: define.h:711
int unlink() const
File Utility : Delete a file.
Dtk_string path() const
File Utility : Retrieves the path in Dtk_string form.
@ BodyType
Definition: dtk_maindoc.hpp:252
FILE * OpenFile(const Dtk_string &inRights) const
File Utility : Open a file with the given rights.
static PK_ERROR_code_t PsErrorHandler(PK_ERROR_sf_t *error_sf)
Definition: LoadBodiesIntoSession.cpp:54
const Dtk_string & GetWorkingDir() const
void EnumerateBodiesInSession()
Definition: LoadBodiesIntoSession.cpp:147
#define DTK_WB
Definition: dtk_string.hpp:40
static Dtk_API * GetAPI()
Get DATAKIT API.
Dtk_string filename() const
File Utility : Retrieves the filename in Dtk_string form.
static bool s_psMemoryActivated
Definition: LoadBodiesIntoSession.cpp:40
This is the Node FullType Class The Dtk_Node::FullType object is used to retrieve the full informatio...
Definition: dtk_maindoc.hpp:273
static void StopPsSession()
Definition: LoadBodiesIntoSession.cpp:130
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
static void ReceiveBodyFromTempFile(const char *inData, Dtk_Size_t inDataSize, const string &inIndent)
Definition: LoadBodiesIntoSession.cpp:365
Definition: util_ptr_dtk.hpp:37
const char * c_str() const
Retrieve the ASCII conversion string.
@ DTK_STREAM_X_B
Definition: dtk_stream.hpp:22
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
static void TraverseNodeBodiesFromStream(Dtk_NodePtr inNode, int inDepth)
Definition: LoadBodiesIntoSession.cpp:428
Dtk_string drive() const
File Utility : Retrieves the drive in Dtk_string form.
static void SetPSchema()
Definition: LoadBodiesIntoSession.cpp:64
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
static bool s_psTraverseActivated
Definition: LoadBodiesIntoSession.cpp:41
int len() const
Retrieve the length of the Dtk_string.
static void StartPsSession()
Definition: LoadBodiesIntoSession.cpp:87
static bool s_psSessionActivated
Definition: LoadBodiesIntoSession.cpp:39