DATAKIT SDK  V2026.1
Full samples source code
/* ------------------------------------------------------------------------- */
/* Datakit JtWriter samples */
/* this file allow to write several JT files */
/* see main function for each case, on the end of this file */
/* ------------------------------------------------------------------------- */
#include "testwriters.h"
#include "datakit.h" // DATAKIT header needed
#include "jw/jtw.h" // JtWrite header needed
#include "tess/tess.h" // tessellation header needed for example from 2.
#include "SampleWriter/testcreatemesh.hpp" // common datakit mesh creation
#include "SampleWriter/testcreatecube.hpp" // common datakit bodies creation
#include "SampleWriter/testcreatefdt.hpp" // common datakit pmi creation
/*******************************************************************************/
//start_of_jtwsample11
// ------------------------------------ SampleOneMesh_1_1 ---------------------------------------------
{
Dtk_Jtw_Interface J(outputFileName, err);
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError; // Automatic Finish while J released
}
//end_of_jtwsample11
// ---------------------------------- SampleMeshes_1_2 -----------------------------------------------
//start_of_jtwsample12
template <typename T>
inline void Shift(T& mesh, double sh)
{
t.addTranslate(Dtk_dir(sh, 0, 0));
mesh->Transform(t);
}
{
Dtk_Jtw_Interface J(outputFileName, err);
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
CHECK_OK(J.AddMesh(CubeMesh)); // write the cube (A)
Dtk_MeshPtr CubePervertexColorMesh = sampleWriter::CreateMeshCubeVertexColor(); // create a per vertex color cube
Shift(CubePervertexColorMesh, 3); // translate it not to be on previous geometry
CHECK_OK(J.AddMesh(CubePervertexColorMesh)); // (B)
Dtk_MeshPtr TransparentCube = sampleWriter::CreateMeshCube(); // create a simple red cube
TransparentCube->info()->SetColor(Dtk_RGB(0, 255, 0, 128)); // set whole cube as green and transparent
Shift(TransparentCube, 6); // translate it not to be on previous geometry
CHECK_OK(J.AddMesh(TransparentCube)); // (C)
Dtk_MeshPtr TransparentOneFaceCube = sampleWriter::CreateMeshCube(); // create a simple red cube
if (TransparentOneFaceCube->get_nb_mesh_face() == 6)
{
if (TransparentOneFaceCube->get_mesh_face(3)->info().IsNULL())
TransparentOneFaceCube->get_mesh_face(3)->info() = Dtk_Info::create();
TransparentOneFaceCube->get_mesh_face(3)->info()->SetColor(Dtk_RGB(0, 0, 255, 128)); // set face 3 as blue and transparent
}
Shift(TransparentOneFaceCube, 9); // translate it not to be on previous geometry (D)
CHECK_OK(J.AddMesh(TransparentOneFaceCube));
Dtk_MeshPtr MeshWire = sampleWriter::CreateMeshWire(); // create wire mesh
Shift(MeshWire, 12); // translate it not to be on previous geometry
CHECK_OK(J.AddMesh(MeshWire)); // (E)
Dtk_MeshPtr MeshPoints = sampleWriter::CreateMeshPoints(); // create a mesh wich contain only orange points.
Shift(MeshPoints, 15); // translate it not to be on previous geometry
CHECK_OK(J.AddMesh(MeshPoints)); // (F)
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError; // Automatic Finish while J released
}
//end_of_jtwsample12
// ---------------------------------- SampleTextures_1_3 -----------------------------------------------
//start_of_jtwsample13
inline void AddVertex( Dtk_MeshPtr mesh, const Dtk_pnt& P, const Dtk_dir& N, float u, float v )
{
mesh->add_vertex( &P, &N, NULL, u, v );
}
{
Dtk_mesh_face* mf = new Dtk_mesh_face( mesh.operator->() );
mesh->add_mesh_face( mf );
AddVertex( mesh, Dtk_pnt( 0, 0, 0 ), Dtk_dir( 0, 0, 1 ), 0, 0 );
AddVertex( mesh, Dtk_pnt( 10, 0, 0 ), Dtk_dir( 0, 0, 1 ), 1, 0 );
AddVertex( mesh, Dtk_pnt( 10, 10, 0 ), Dtk_dir( 0, 0, 1 ), 1, 1 );
AddVertex( mesh, Dtk_pnt( 0, 10, 0 ), Dtk_dir( 0, 0, 1 ), 0, 1 );
inds.push_back( 0 ); inds.push_back( 1 ); inds.push_back( 2 );
inds.push_back( 0 ); inds.push_back( 2 ); inds.push_back( 3 );
mf->add_triangles(&inds );
// texture
Dtk_picture picture;
picture.MetricHeight() = picture.MetricWidth() = 256;
picture.PixelWidth() = 256;
picture.PixelHeight() = 256;
picture.File().resize( 256 * 256 * 3 );
size_t i, size = picture.File().size();
for( i = 0; i < size; i++ ) // make "random" pixels
picture.File()[ i ] = ( i * i + i / 256 ) % 256;
texture->SetTextureImage( &picture );
Dtk_RenderInfosPtr render = Dtk_RenderInfos::Create( "uselessname", NULL, texture );
mf->info()->AddRenderInfos( render );
return mesh;
}
{
Dtk_Jtw_Interface J( outputFileName, err );
CHECK_OK( err );
CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
Dtk_MeshPtr TextureMesh = CreateTextureMesh(); // create a simple red cube
CHECK_OK( J.AddMesh( TextureMesh ) ); // write the cube
CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError; // Automatic Finish while J released
}
//end_of_jtwsample13
// ---------------------------------- SampleBody_2_1 -----------------------------------------------
//start_of_jtwsample21
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample21
// --------------------------------- SampleBodyLOD_2_2 ------------------------------------------------
//start_of_jtwsample22
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body, tessellated as default tess_InitTesselation value
Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(1, 2); // Create another Cylinder radius=1, height=2 (with a green face)
Shift(cylinder2, 3); // shift the cylinder, see exemple above
Dtk_tab<Dtk_Float32> lods; // create a LOD array
lods.push_back(0.001f); lods.push_back(-1); // Highest LOD : linear tol = 0.001, angular automatic
lods.push_back(0.01f); lods.push_back(-1); // Medium LOD : linear tol = 0.01, angular automatic
lods.push_back(0.1f); lods.push_back(-1); // Lower LOD : linear tol = 0.1, angular automatic
CHECK_OK(J.AddBody(cylinder2, lods)); // add the body, will tessellate automaticly for LODS.
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample22
// ---------------------------------- SampleWireBody_2_3 -----------------------------------------------
//start_of_jtwsample23
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.AddBody(wire));
CHECK_OK(J.AddBody(wire2));
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample23
// ---------------------------------- SampleBodyVisibility_2_4 -----------------------------------------------
//start_of_jtwsample24
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.AddBody(cylinder));
Shift(cylinder2, 3);
CHECK_OK(J.AddBody(cylinder2));
Shift(cylinder3, 6);
cylinder3->info()->SetBlankedStatus(DTK_TRUE);
CHECK_OK(J.AddBody(cylinder3));
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample24
// ---------------------------------- SampleLightmap_2_5 -----------------------------------------------
//start_of_jtwsample25
void SetLightMapOnOneFace( Dtk_BodyPtr& body, const Dtk_RGB& ambiant, const Dtk_RGB& diffuse,
const Dtk_RGB& specular, float shininess )
{
size_t i, nb = body->GetNumTopologicalEntities( DTK_TYPE_UNKNOWN );
for( i = 0; i < nb; i++ )
{// fetch first face, then abort
Dtk_TopologicalEntityPtr topo = body->GetPtr( (Dtk_ID)i );
if( topo.IsNULL() || topo->get_type_detk() != DTK_TYPE_FACE )
continue;
Dtk_LightMapPtr lightmap = Dtk_LightMap::Create( ambiant, diffuse, specular );
lightmap->SetShininessRatio( shininess );
Dtk_RenderInfosPtr render = Dtk_RenderInfos::Create( "uselessname", lightmap, NULL );
face->info()->AddRenderInfos( render );
break;
}
}
{
Dtk_Jtw_Interface J( outputFileName, err, Dtk_Jtw_Interface::xtbrep ); // Specify allowing BREP Writing
CHECK_OK( err );
CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
SetLightMapOnOneFace( cylinder, Dtk_RGB( 50, 50, 50 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 0, 0, 255 ), 0 );
CHECK_OK( J.AddBody( cylinder ) );
Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl( 1, 2 );
Shift( cylinder2, 3 );
SetLightMapOnOneFace( cylinder2, Dtk_RGB( 50, 50, 50 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 0, 0, 0 ), 0.5 );
CHECK_OK( J.AddBody( cylinder2 ) );
Dtk_BodyPtr cylinder3 = sampleWriter::CreateCyl( 1, 2 );
Shift( cylinder3, 6 );
SetLightMapOnOneFace( cylinder3, Dtk_RGB( 100, 50, 30 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 255, 255, 255 ), 1 );
CHECK_OK( J.AddBody( cylinder3 ) );
CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample25
// --------------------------------- SampleLossyCompression_2_6 ------------------------------------------------
//start_of_jtwsample26
{
Dtk_Jtw_Interface J( outputFileName, err, Dtk_Jtw_Interface::xtbrep ); // Specify allowing BREP Writing
CHECK_OK( err );
CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 1, 2 ); // Create a Cylinder radius=1, height=2 (with a green face)
CHECK_OK( J.AddBody( cylinder ) ); // Add the body, tessellated as default tess_InitTesselation value
Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl( 1, 2 ); // Create another Cylinder radius=1, height=2 (with a green face)
Shift( cylinder2, 3 ); // shift the cylinder, see exemple above
Dtk_tab<Dtk_Float32> lods; // create a LOD array
lods.push_back( 0.001f ); lods.push_back( -1 ); // Highest LOD : linear tol = 0.001, angular automatic
lods.push_back( 0.01f ); lods.push_back( -1 ); // Medium LOD : linear tol = 0.01, angular automatic
lods.push_back( 0.1f ); lods.push_back( -1 ); // Lower LOD : linear tol = 0.1, angular automatic
CHECK_OK( J.AddBody( cylinder2, lods , 0.01f ) ); // add the body, will tessellate automaticly for LODS, and a Lossy factor of 0.01
CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample26
// ------------------------------------ SampleAssembly_3_1 ---------------------------------------------
//start_of_jtwsample31
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
CHECK_OK(J.OpenInstance("Wheel")); // open
Shift(wheel, 2);
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2")); // open
Shift(wheel, 3);
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample31
// -------------------------------- SamplePartInstances_3_2 -------------------------------------------------
//start_of_jtwsample32
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample32
// -------------------------------- SampleAsmInstances_3_3 -------------------------------------------------
//start_of_jtwsample33
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_Int64 id_of_axles = 2;
CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample33
// -------------------------------- SampleInstancesColors_3_4 -------------------------------------------------
//start_of_jtwsample34
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_Int64 id_of_axles = 2;
CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(5, 0, 0))));
// Give a RED color with transparence, with keepsubcolor strategy : only uncolored faces are filled
CHECK_OK(J.CloseLastInstance()); // close Axles2
CHECK_OK(J.OpenInstance("Axles3", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0))));
// Give a BLUE color, with overwrite color strategy : all faces are filled
CHECK_OK(J.CloseLastInstance()); // close Axles2
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample34
// -------------------------------- SampleInstancesVisibily_3_5 -------------------------------------------------
//start_of_jtwsample35
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt())));
CHECK_OK(J.LastInstance_SetInvisible()); // Set as invisible
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample35
// -------------------------------- SampleMultipleFilesPerPart_3_6 -------------------------------------------------
//start_of_jtwsample36
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_Int64 id_of_axles = 2;
CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
CHECK_OK(J.OpenInstance("Axle",Dtk_transfo(), "assembly/axle.jt"));// open instance in a new file.
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)), "assembly/wheel.jt"));
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
CHECK_OK(J.CloseLastInstance()); // close Axles2
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample36
// -------------------------------- SampleMultipleFilesShattered_3_7 -------------------------------------------------
//start_of_jtwsample37
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_Int64 id_of_axles = 2;
CHECK_OK(J.OpenInstance("Axles", id_of_axles, Dtk_transfo(), "shattered_axles.jt")); // open Axles, give an ID for future reinstance, open instance in a new file.
CHECK_OK(J.OpenInstance("Axle", Dtk_transfo(), "shattered_axle.jt")); // open instance in a new file.
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels", Dtk_transfo(), "shattered_wheels.jt")); // open instance in a new file.
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)), "shattered_wheel.jt")); // open instance in a new file.
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly."
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
CHECK_OK(J.CloseLastInstance()); // close Axles2
CHECK_OK(J.CloseLastInstance()); // close RootNode
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample37
// ------------------------------------ SampleVersion_4_1 ---------------------------------------------
//start_of_jtwsample41
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep, Dtk_Jtw_Interface::version80); // set version 8.0
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample41
// ------------------------------------ SampleUnits_4_2 ---------------------------------------------
//start_of_jtwsample42
{
// set units as inches
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample42
// ------------------------------- SampleMetadatas_4_3 --------------------------------------------------
//start_of_jtwsample43
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample43
// -------------------------------- SampleLayers_4_4 -------------------------------------------------
//start_of_jtwsample44
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.OpenInstance("Cyl1"));
cylinder->info()->SetLayer(3);
CHECK_OK(J.AddBody(cylinder)); // Add the body
CHECK_OK(J.OpenInstance("Cyl2"));
cylinder2->info()->SetLayer(5);
Shift(cylinder2, 3);
CHECK_OK(J.AddBody(cylinder2)); // Add the body
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample44
// -------------------------------- SampleLayerNames_4_5 -------------------------------------------------
//start_of_jtwsample45
{
lay->SetLayerID(0, 3); // layer 0 has ID 3
lay->SetLayerID(1, 5); // layer 1 has ID 5
lay->SetLayerName(0, "LayerThree");
lay->SetLayerName(1, "LayerFive");
return lay;
}
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
CHECK_OK(J.OpenInstance("Cyl1"));
cylinder->info()->SetLayer(3);
CHECK_OK(J.AddBody(cylinder)); // Add the body
CHECK_OK(J.OpenInstance("Cyl2"));
cylinder2->info()->SetLayer(5);
Shift(cylinder2, 3);
CHECK_OK(J.AddBody(cylinder2)); // Add the body
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample45
// -------------------------------- SampleSimplePMI_5_1 -------------------------------------------------
//start_of_jtwsample51
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=1, height=2 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi)); // Add the PMI
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample51
// -------------------------------- SampleSimpleModelview_5_2 -------------------------------------------------
//start_of_jtwsample52
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi)); // Add the PMI
Dtk_pnt from(0, 0, 100);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(0, 1, 0);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 100, 100, up); // semiwidth = 100
mvfit->info() = Dtk_Info::create();
mvfit->info()->SetName("FitView");
from = Dtk_pnt(300, 300, 300);
up = Dtk_dir(-0.57735, 0.57735, -0.57735);
cam = Dtk_Camera::Create(from, to, 250, 250, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample52
// -------------------------------- SamplePMI_MV_association_5_3 -------------------------------------------------
//start_of_jtwsample53
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample53
// -------------------------------- SamplePMI_Geom_association_5_4 -------------------------------------------------
//start_of_jtwsample54
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE)); // Connect PMI 5 on body, on face ID= 2
CHECK_OK(J.ConnectPMI_Geom(5, 15, DTK_TYPE_EDGE)); // Connect PMI 5 on body, on edge ID= 15
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample54
// -------------------------------- SampleModelview_sections_5_5 -------------------------------------------------
//start_of_jtwsample55
{
body->AddOpenShell(shell);
section1->info() = Dtk_Info::create();
section1->info()->SetColor(Dtk_RGB(128, 0, 0)); // red
shell->AddFace(face1, DTK_TRUE);
section2->info() = Dtk_Info::create();
section2->info()->SetColor(Dtk_RGB(0, 0, 128)); // blue
shell->AddFace(face2, DTK_TRUE);
}
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
Dtk_PlaneSurfacePtr section = Dtk_PlaneSurface::Create(Dtk_pnt(), Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0)); // (A)
//Dtk_EntityPtr section = MakeMultiSection(); // (B)
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE)); // Connect PMI 5 on body, on face ID= 2
CHECK_OK(J.ConnectPMI_Geom(5, 15, DTK_TYPE_EDGE)); // Connect PMI 5 on body, on edge ID= 15
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample55
// -------------------------------- SamplePMI_PMI_association_5_6 -------------------------------------------------
//start_of_jtwsample56
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
int i;
for (i = 0; i < 10; i++) // create 10 PMI
{
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
Shift(pmi, 15 * i);
CHECK_OK(J.AddPMI(pmi, 5 + i)); // Add the PMI, set ID = 5
}
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 30)); // Add Modelview, set ID = 8
for (i = 0; i < 10; i++) // link the 10 PMIto ModelView
{
}
CHECK_OK(J.ConnectPMI_PMI(6, 8)); // Associate PMI 6 to PMI 8
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample56
// -------------------------------- SampleAxis_References_5_7 -------------------------------------------------
//start_of_jtwsample57
{
body->info() = Dtk_Info::create();
body->info()->SetName("MyReferencePlane");
body->info()->SetInfiniteGeometryFlag(1); // mandatory
body->info()->SetColor(Dtk_RGB(128, 0, 0)); // color red
body->AddOpenShell(shell);
double box[4] = { -200,200,-200,200 }; // trim of the plane
plane->SetTrimUVBox(box);
shell->AddFace(face1, DTK_TRUE);
return body;
}
{
body->info() = Dtk_Info::create();
body->info()->SetName("MyReferenceAxis");
body->info()->SetInfiniteGeometryFlag(1); // mandatory
body->info()->SetColor(Dtk_RGB(0, 128, 0)); // color green
body->AddOpenShell(shell);
Dtk_LinePtr L = Dtk_Line::Create(Dtk_pnt(100, 100, 0), Dtk_dir(0, 0, 1));
L->SetTrimmingParameters(0.0, 200.0);
shell->AddWire(tabwire);
return body;
}
{
body->info() = Dtk_Info::create();
body->info()->SetName("MyReferencePoint");
body->info()->SetInfiniteGeometryFlag(1); // mandatory
body->info()->SetColor(Dtk_RGB(0, 0, 128)); // color blue
body->AddOpenShell(shell);
Dtk_PointPtr point = Dtk_Point::Create(Dtk_pnt(120, 120, 0));
tabpoints.push_back(point);
shell->AddWire(tabpoints);
return body;
}
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
axis->SetMatrix(Dtk_transfo(Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0), Dtk_dir(0, 0, 1), Dtk_pnt(100, 100, 0))); // X,Y,Z, O
axis->SetName("MyAxisSystem"); // give a name
CHECK_OK(J.AddAxisSystem(axis, 50)); // give ID 50
CHECK_OK(J.ConnectPMI_ModelView(50, 8)); // Connect AxisSystem 50 to Modelview 8
CHECK_OK(J.AddReferenceGeometry(refplane, 60)); // give ID 60
CHECK_OK(J.ConnectPMI_ModelView(60, 8)); // Connect Referenceplane 50 to Modelview 8
CHECK_OK(J.AddReferenceGeometry(refaxis, 70)); // give ID 70
CHECK_OK(J.ConnectPMI_ModelView(70, 8)); // Connect Referenceplane 60 to Modelview 8
CHECK_OK(J.AddReferenceGeometry(refpoint, 80)); // give ID 80
CHECK_OK(J.ConnectPMI_ModelView(80, 8)); // Connect Referenceplane 70 to Modelview 8
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample57
// -------------------------------- SamplePMI_Geom_one_association_5_8 -------------------------------------------------
//start_of_jtwsample58
{
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
cylinder->info()->SetId(10);
CHECK_OK(J.AddBody(cylinder)); // Add the body
Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
Shift(cylinder2, 250);
cylinder2->info()->SetId(11);
CHECK_OK(J.AddBody(cylinder2)); // Add the body
Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("SecondView");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE, Dtk_tab<Dtk_Int64>(), 10)); // Connect PMI 5 on body 10, on face ID= 2
CHECK_OK(J.ConnectPMI_Geom(5, 15, DTK_TYPE_EDGE, Dtk_tab<Dtk_Int64>(), 11)); // Connect PMI 5 on body 11, on edge ID= 15
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample58
// -------------------------------- SampleModelViewAsm_6_1 -------------------------------------------------
//start_of_jtwsample61
{
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(0, 0, 0);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 5, 5, up);
mv->info() = Dtk_Info::create();
mv->info()->SetName(name);
return mv;
}
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
Dtk_Int64 id_of_axles = 2;
CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
CHECK_OK(J.OpenInstance("Axle")); // open
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels")); // open
Dtk_Int64 id_of_wheel = 1;
CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(5, 0, 0)))); // reinstance whole subassembly with matrix
CHECK_OK(J.CloseLastInstance()); // close Axles2
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample61
// -------------------------------- SampleModelViewTarget_6_2 ; 6.3 ; 6.4 -------------------------------------------------
//start_of_jtwsample62
{
for (int i = 0; i < nb; i++)
res.push_back(r[i]);
return res;
}
{
double scale = 0.1;
Dtk_transfo rescale(Dtk_dir(scale, 0, 0), Dtk_dir(0, scale, 0), Dtk_dir(0, 0, scale), scale * Dtk_pnt(-50., -100., -50.));
pmi->Transform(rescale);
Dtk_transfo shift;
shift.addTranslate(D);
pmi->Transform(shift);
return pmi;
}
{
Dtk_pnt from(300, 300, 300);
Dtk_pnt to(3, 0, 3);
Dtk_dir up(-0.57735, 0.57735, -0.57735);
Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 5, 5, up);
mv2->info() = Dtk_Info::create();
mv2->info()->SetName("View");
CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
if (option == 1) // 6.2. Add instances by addition
{
Dtk_Int64 r1[] = { 1,11,2,13,4,14 }; // target one specific wheel
Dtk_Int64 r2[] = { 1,16 }; // target one specific axle subassembly
}
if (option == 2) // 6.3. Remove instances (soustraction)
{
Dtk_Int64 r1[] = { 1,11,2,13,4,14 }; // target one specific wheel
CHECK_OK(J.ConnectModelView_Instance(8, Makeroute(r1, 6), 1)); // last parameter hide = 1
}
if (option == 3) // 6.4. Target PMI on assembly geometry
{
CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // set PMI into Modelview
Dtk_Int64 r1[] = { 1,11,2,13,4,15,5 }; // target one specific wheel
Dtk_Int64 r2[] = { 1,16,2,12, 3 }; // target one specific axle
}
if( option == 4 ) // 6.2. Add instances by addition, and shift for exploded view
{
Dtk_Int64 rsub[] = { 1,16 }; // target one specific axle subassembly
Dtk_Int64 rw1[] = { 1,11,2,13,4,14 }; // target the first wheel of the other axle subassembly
Dtk_Int64 rw2[] = { 1,11,2,13,4,15 }; // target the second wheel of the other axle subassembly
Dtk_Int64 ra[] = { 1,11,2,12 }; // target the axle of the other axle subassembly
Dtk_dir X( 1, 0, 0 );
Dtk_dir Y( 0, 1, 0 );
Dtk_dir Z( 0, 0, 1 );
Dtk_transfo newplacementwheel1( X, Y, Z, Dtk_pnt( 0, 0, 8 ) );
Dtk_transfo newplacementwheel2( X, -Y, -Z, Dtk_pnt( 0, 0, -3 ) );
CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( rw1, 6 ), 0, 0, &newplacementwheel1 ) );
CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( rw2, 6 ), 0, 0, &newplacementwheel2 ) );
}
return dtkNoError;
}
Dtk_ErrorStatus JtwSampleModelViewTarget_6_2(const Dtk_string& outputFileName,int option)
{
Dtk_dir X(1, 0, 0);
Dtk_dir Y(0, 1, 0);
Dtk_dir Z(0, 0, 1);
Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
CHECK_OK(err);
CHECK_OK(J.OpenInstance("RootNode", 1)); // Rootnode creation
CHECK_OK(J.OpenInstance("Axles", 2));
CHECK_OK(J.OpenInstance("Axle", 3));
CHECK_OK(J.AddBody(axle));
CHECK_OK(J.CloseLastInstance()); // close Axle
CHECK_OK(J.OpenInstance("Wheels", 4));
CHECK_OK(J.OpenInstance("Wheel", 5, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5))));
CHECK_OK(J.AddBody(wheel));
CHECK_OK(J.CloseLastInstance()); // close Wheel
CHECK_OK(J.OpenInstance("Wheel2", 5, Dtk_transfo(X, -Y, -Z, Dtk_pnt())));
CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel2 immediatly.
CHECK_OK(J.CloseLastInstance()); // close Wheels
CHECK_OK(J.CloseLastInstance()); // close Axles
CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(6, 0, 0))));
CHECK_OK(J.CloseLastInstance()); // close Axles2
MakePmiOnRoot(J, option);
CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
cout << "=> " << outputFileName.c_str() << endl;
return dtkNoError;// Automatic Finish while J released
}
//end_of_jtwsample62
// -------------------------------- main -------------------------------------------------
//start_of_jtwtests
int AllJtWTests(const Dtk_string &inResultDirectory)
{
Dtk_ErrorStatus errorStatus;
Dtk_string outputDirectory, outputFileName;
// Choosing output directory and file name
outputDirectory = inResultDirectory + L"Jt/";
outputDirectory.FixPathSeparator();
outputDirectory.mkdir();
// samples meshes
outputFileName = outputDirectory + L"JTW_1_1_SampleMesh.jt";
errorStatus = JtwSampleOneMesh_1_1( outputFileName );
outputFileName = outputDirectory + L"JTW_1_2_SampleMeshes.jt";
errorStatus = JtwSampleMeshes_1_2( outputFileName );
outputFileName = outputDirectory + L"JTW_1_3_SampleTextures.jt";
errorStatus = JtwSampleTextures_1_3( outputFileName );
outputFileName = outputDirectory + L"JTW_2_1_SampleBody.jt";
errorStatus = JtwSampleBody_2_1( outputFileName);
outputFileName = outputDirectory + L"JTW_2_2_SampleBodyLOD.jt";
errorStatus = JtwSampleBodyLOD_2_2( outputFileName );
outputFileName = outputDirectory + L"JTW_2_3_SampleWireBody.jt";
errorStatus = JtwSampleWireBody_2_3( outputFileName );
outputFileName = outputDirectory + L"JTW_2_4_SampleBodyVisibility.jt";
errorStatus = JtwSampleBodyVisibility_2_4( outputFileName );
outputFileName = outputDirectory + L"JTW_2_5_SampleLightmap.jt";
errorStatus = JtwSampleLightmap_2_5( outputFileName );
outputFileName = outputDirectory + L"JTW_2_6_SampleLossy.jt";
errorStatus = SampleLossyCompression_2_6( outputFileName );
outputFileName = outputDirectory + L"JTW_3_1_SampleAssembly.jt";
errorStatus = JtwSampleAssembly_3_1( outputFileName );
outputFileName = outputDirectory + L"JTW_3_2_SamplePartInstances.jt";
errorStatus = JtwSamplePartInstances_3_2( outputFileName );
outputFileName = outputDirectory + L"JTW_3_3_SampleAsmInstances.jt";
errorStatus = JtwSampleAsmInstances_3_3( outputFileName );
outputFileName = outputDirectory + L"JTW_3_4_SampleInstancesColors.jt";
errorStatus = JtwSampleInstancesColors_3_4( outputFileName );
outputFileName = outputDirectory + L"JTW_3_5_SampleInstancesVisibily.jt";
errorStatus = JtwSampleInstancesVisibily_3_5( outputFileName );
outputFileName = outputDirectory + L"JTW_3_6_SampleMultipleFilesPerPart.jt";
errorStatus = JtwSampleMultipleFilesPerPart_3_6( outputFileName );
outputFileName = outputDirectory + L"JTW_3_7_SampleMultipleFilesShattered.jt";
errorStatus = JtwSampleMultipleFilesShattered_3_7( outputFileName );
outputFileName = outputDirectory + L"JTW_4_1_SampleVersion.jt";
errorStatus = JtwSampleVersion_4_1( outputFileName );
outputFileName = outputDirectory + L"JTW_4_2_SampleUnits.jt";
errorStatus = JtwSampleUnits_4_2( outputFileName );
outputFileName = outputDirectory + L"JTW_4_3_SampleMetadatas.jt";
errorStatus = JtwSampleMetadatas_4_3( outputFileName );
outputFileName = outputDirectory + L"JTW_4_4_SampleLayers.jt";
errorStatus = JtwSampleLayers_4_4( outputFileName );
outputFileName = outputDirectory + L"JTW_4_5_SampleLayerNames.jt";
errorStatus = JtwSampleLayerNames_4_5( outputFileName );
outputFileName = outputDirectory + L"JTW_5_1_SampleSimplePMI.jt";
errorStatus = JtwSampleSimplePMI_5_1( outputFileName );
outputFileName = outputDirectory + L"JTW_5_2_SampleSimpleModelview.jt";
errorStatus = JtwSampleSimpleModelview_5_2( outputFileName );
outputFileName = outputDirectory + L"JTW_5_3_SamplePMI_MV_association.jt";
errorStatus = JtwSamplePMI_MV_association_5_3( outputFileName );
outputFileName = outputDirectory + L"JTW_5_4_SamplePMI_Geom_association.jt";
errorStatus = JtwSamplePMI_Geom_association_5_4( outputFileName);
outputFileName = outputDirectory + L"JTW_5_5_SampleModelview_sections.jt";
errorStatus = JtwSampleModelview_sections_5_5( outputFileName );
outputFileName = outputDirectory + L"JTW_5_6_SamplePMI_PMI_association.jt";
errorStatus = JtwSamplePMI_PMI_association_5_6( outputFileName );
outputFileName = outputDirectory + L"JTW_5_7_SampleAxis_References.jt";
errorStatus = JtwSampleAxis_References_5_7( outputFileName );
outputFileName = outputDirectory + L"JTW_5_8_SamplePMI_Geom_one_association.jt";
errorStatus = JtwSamplePMI_Geom_one_association_5_8( outputFileName );
outputFileName = outputDirectory + L"JTW_6_1_SampleModelViewAsm.jt";
errorStatus = JtwSampleModelViewAsm_6_1( outputFileName );
outputFileName = outputDirectory + L"JTW_6_2_SampleModelViewTarget.jt";
errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 1);
outputFileName = outputDirectory + L"JTW_6_3_SampleModelViewRemove.jt";
errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 2);
outputFileName = outputDirectory + L"JTW_6_4_SampleAsmPMITarget.jt";
errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 3);
outputFileName = outputDirectory + L"JTW_6_5_SampleAsmExplodedView.jt";
errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 4 );
return errorStatus;
}
//end_of_jtwtests
//start_of_jtwmain
int JtWriteSample(const Dtk_string &inResultDirectory)
{
cout << endl << "----------------------------------------------" << endl;
cout <<"Jt Write start" << endl;
tess_InitTesselation("./", 0.005); // Init Tessellation : working directory and default tolerance (needed for writing bodies)
tess_ComputeBoundariesFromMesh(0); // Disable wire creation on mesh during Brep tessellation.
int err = AllJtWTests(inResultDirectory); // all tests.
tess_EndTesselation(); // End of tessellation
cout <<"Jt Write end" << endl;
return err;
}
//end_of_jtwmain
CreateFdtDatumAt
Dtk_FdtPtr CreateFdtDatumAt(const Dtk_pnt &D)
Definition: testlibjtwrite.cpp:1135
Dtk_ModelDisplay::Create
static Dtk_ModelDisplayPtr Create(const Dtk_CameraPtr &inCamera, const Dtk_EntityPtr &inClippingEntity, const Dtk_bool inIsActivated)
Calls full featured constructor to allocate a new object.
testcreatefdt.hpp
JtwSampleLightmap_2_5
Dtk_ErrorStatus JtwSampleLightmap_2_5(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:253
DTK_MESH_NORMAL
#define DTK_MESH_NORMAL
Definition: util_mesh_dtk.hpp:31
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:692
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_mesh_face
This is a high level face class.
Definition: util_mesh_dtk.hpp:865
JtwSampleMetadatas_4_3
Dtk_ErrorStatus JtwSampleMetadatas_4_3(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:624
Dtk_Jtw_Interface::OpenInstance
Dtk_ErrorStatus OpenInstance(const Dtk_string &inName, const Dtk_transfo &inTrans=Dtk_transfo(), const Dtk_string &inExternfile=Dtk_string())
Open a new Instance for the assembly writing.
DTK_TYPE_UNKNOWN
@ DTK_TYPE_UNKNOWN
Definition: define.h:37
Dtk_TextureInfos::Create
static Dtk_TextureInfosPtr Create(const TextureMappingTypeEnum &inType)
Create a Dtk_TextureInfosPtr.
Dtk_PlaneSurface::Create
static Dtk_PlaneSurfacePtr Create(const Dtk_pnt &inOrigin, const Dtk_dir &inNormal, const Dtk_dir &inUDirection, const Dtk_dir &inVDirection=Dtk_dir())
Create an infinite plane surface.
DTK_PICTURE_RGB24
@ DTK_PICTURE_RGB24
Definition: dtk_picture.hpp:28
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:204
Dtk_Jtw_Interface::LastInstance_SetInstanceColor
Dtk_ErrorStatus LastInstance_SetInstanceColor(const Dtk_RGB &inRgb, colorstrategy inColorstrategy=keepsubcolor)
Set a Color to previously opened instance.
jtw.h
Dtk_picture::PixelWidth
Dtk_Size_t & PixelWidth()
Retrieves the width (in pixels)
Definition: dtk_picture.hpp:91
AddVertex
void AddVertex(Dtk_MeshPtr mesh, const Dtk_pnt &P, const Dtk_dir &N, float u, float v)
Definition: testlibjtwrite.cpp:94
sampleWriter::CreateCyl
Dtk_BodyPtr CreateCyl(double radius, double height)
Definition: testcreatecube.cpp:1750
sampleWriter::CreateMeshCubeVertexColor
Dtk_MeshPtr CreateMeshCubeVertexColor()
Definition: testcreatemesh.cpp:296
CreateLayerInfosSet
Dtk_LayerInfosSetPtr CreateLayerInfosSet()
Definition: testlibjtwrite.cpp:674
sampleWriter::CreateMeshPoints
Dtk_MeshPtr CreateMeshPoints()
Points mesh sample.
Definition: testcreatemesh.cpp:436
tess_InitTesselation
int tess_InitTesselation(Dtk_string inWorkingDirectory, double inTolerance)
Init the tesselation library.
DTK_TRUE
#define DTK_TRUE
Definition: define.h:730
Dtk_mesh::Create
static Dtk_MeshPtr Create(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
Constructor.
JtwSamplePMI_MV_association_5_3
Dtk_ErrorStatus JtwSamplePMI_MV_association_5_3(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:772
Dtk_Info::AddRenderInfos
Dtk_ErrorStatus AddRenderInfos(const Dtk_RenderInfosPtr &inRender)
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Jtw_Interface::keepsubcolor
@ keepsubcolor
Definition: jtw.h:30
JtWriteSample
int JtWriteSample(const Dtk_string &inResultDirectory)
Definition: testlibjtwrite.cpp:1329
JtwSampleModelViewTarget_6_2
Dtk_ErrorStatus JtwSampleModelViewTarget_6_2(const Dtk_string &outputFileName, int option)
Definition: testlibjtwrite.cpp:1199
JtwSampleAxis_References_5_7
Dtk_ErrorStatus JtwSampleAxis_References_5_7(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:986
JtwSampleBodyLOD_2_2
Dtk_ErrorStatus JtwSampleBodyLOD_2_2(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:161
JtwSampleMultipleFilesShattered_3_7
Dtk_ErrorStatus JtwSampleMultipleFilesShattered_3_7(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:548
Dtk_RenderInfos::Create
static Dtk_RenderInfosPtr Create(const Dtk_string &inName)
Create a Dtk_RenderInfosPtr.
Dtk_AxisSystem::create
static Dtk_SmartPtr< Dtk_AxisSystem > create()
Calls default constructor to allocate a new object.
Dtk_Jtw_Interface::ConnectPMI_Geom
Dtk_ErrorStatus ConnectPMI_Geom(Dtk_Int64 inIdfdt, Dtk_Int64 inGeomid, type_detk inTypegeom, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >(), Dtk_ID inBodyID=0)
Connect a PMI on a body face/edge/vertex.
Dtk_Jtw_Interface::CloseLastInstance
Dtk_ErrorStatus CloseLastInstance()
Close the last opened node.
Dtk_Body::Create
static Dtk_BodyPtr Create()
Create a body.
DTK_MESH_XYZ
#define DTK_MESH_XYZ
Definition: util_mesh_dtk.hpp:30
Dtk_LightMap::Create
static Dtk_LightMapPtr Create(Dtk_RGB inAmbiant, Dtk_RGB inDiffuse, Dtk_RGB inSpecular)
Create a Dtk_LightMapPtr.
Dtk_picture::MetricWidth
double & MetricWidth()
Retrieves the width (in mm)
Definition: dtk_picture.hpp:101
tess_ComputeBoundariesFromMesh
void tess_ComputeBoundariesFromMesh(int value)
Set boundaries computation from mesh option. Default value is enabled (1). See tess_getBoundariesFrom...
DTK_MESH_UV_TEXTURES
#define DTK_MESH_UV_TEXTURES
Definition: util_mesh_dtk.hpp:33
SetLightMapOnOneFace
void SetLightMapOnOneFace(Dtk_BodyPtr &body, const Dtk_RGB &ambiant, const Dtk_RGB &diffuse, const Dtk_RGB &specular, float shininess)
Definition: testlibjtwrite.cpp:235
JtwSampleBody_2_1
Dtk_ErrorStatus JtwSampleBody_2_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:146
Dtk_Jtw_Interface::xtbrep
@ xtbrep
Definition: jtw.h:26
Dtk_picture::PixelHeight
Dtk_Size_t & PixelHeight()
Retrieves the height (in pixels)
Definition: dtk_picture.hpp:96
JtwSampleWireBody_2_3
Dtk_ErrorStatus JtwSampleWireBody_2_3(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:187
MakeReferenceAxis
Dtk_BodyPtr MakeReferenceAxis()
Definition: testlibjtwrite.cpp:953
Dtk_picture::FileType
Dtk_PictureType & FileType()
Retrieves the file type.
Definition: dtk_picture.hpp:87
JtwSampleModelview_sections_5_5
Dtk_ErrorStatus JtwSampleModelview_sections_5_5(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:857
Dtk_Face::Create
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
JtwSampleInstancesColors_3_4
Dtk_ErrorStatus JtwSampleInstancesColors_3_4(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:421
JtwSamplePMI_Geom_association_5_4
Dtk_ErrorStatus JtwSamplePMI_Geom_association_5_4(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:803
JtwSampleLayers_4_4
Dtk_ErrorStatus JtwSampleLayers_4_4(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:646
Dtk_Jtw_Interface::version95
@ version95
Definition: jtw.h:41
sampleWriter::CreateMeshWire
Dtk_MeshPtr CreateMeshWire()
Wire mesh sample.
Definition: testcreatemesh.cpp:385
Dtk_picture::MetricHeight
double & MetricHeight()
Retrieves the height (in mm)
Definition: dtk_picture.hpp:105
Dtk_Jtw_Interface::AddMetaData
Dtk_ErrorStatus AddMetaData(const Dtk_MetaDataPtr &inToWrite)
Add a Metdata into the current node.
Dtk_picture::File
Dtk_tab< char > & File()
Retrieves the binary file.
Definition: dtk_picture.hpp:83
JtwSampleInstancesVisibily_3_5
Dtk_ErrorStatus JtwSampleInstancesVisibily_3_5(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:470
Dtk_picture
This class defines a picture.
Definition: dtk_picture.hpp:45
Dtk_Int64
int64_t Dtk_Int64
Definition: define.h:695
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Creates simple Datum.
Definition: testcreatefdt.cpp:15
Dtk_TextureInfos::StoredUVMapping
@ StoredUVMapping
Definition: dtk_render.hpp:38
Dtk_tab::resize
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
DTK_TYPE_FACE
@ DTK_TYPE_FACE
Definition: define.h:143
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:28
Dtk_SmartPtr< Dtk_Face >::DtkDynamicCast
static Dtk_SmartPtr< Dtk_Face > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_SmartPtr::IsNULL
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Dtk_Face::SetGeom
void SetGeom(const Dtk_SurfacePtr &inSurface)
Set Geometry.
Dtk_Jtw_Interface::AddPMI
Dtk_ErrorStatus AddPMI(const Dtk_FdtPtr &inPMI, Dtk_Int64 inIdpmi=-1)
Add a fdt into the current node.
Dtk_Jtw_Interface::AddAxisSystem
Dtk_ErrorStatus AddAxisSystem(const Dtk_AxisSystemPtr &inAxisSystem, Dtk_Int64 inIdaxis=-1)
Add an axis system into the current node.
JtwSampleVersion_4_1
Dtk_ErrorStatus JtwSampleVersion_4_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:592
CHECK_OK
#define CHECK_OK(X)
Definition: testwriters.h:9
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
JtwSampleOneMesh_1_1
Dtk_ErrorStatus JtwSampleOneMesh_1_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:24
Dtk_Jtw_Interface::inches
@ inches
Definition: jtw.h:59
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
Dtk_Jtw_Interface::version80
@ version80
Definition: jtw.h:35
SampleLossyCompression_2_6
Dtk_ErrorStatus SampleLossyCompression_2_6(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:283
CreateTextureMesh
Dtk_MeshPtr CreateTextureMesh()
Definition: testlibjtwrite.cpp:99
Dtk_Point::Create
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
JtwSampleLayerNames_4_5
Dtk_ErrorStatus JtwSampleLayerNames_4_5(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:684
JtwSampleAssembly_3_1
Dtk_ErrorStatus JtwSampleAssembly_3_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:310
tess.h
JtwSampleSimplePMI_5_1
Dtk_ErrorStatus JtwSampleSimplePMI_5_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:715
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
JtwSamplePMI_Geom_one_association_5_8
Dtk_ErrorStatus JtwSamplePMI_Geom_one_association_5_8(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:1030
MakeReferencePlane
Dtk_BodyPtr MakeReferencePlane()
Definition: testlibjtwrite.cpp:935
Dtk_Jtw_Interface::LastInstance_SetInvisible
Dtk_ErrorStatus LastInstance_SetInvisible()
Set previously opened instance as invisible.
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
Dtk_Jtw_Interface::AddModelView
Dtk_ErrorStatus AddModelView(const Dtk_ModelDisplayPtr &inModelview, Dtk_Int64 inIdmodelview=-1)
Add a modelView into the current node.
datakit.h
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Calls default constructor to allocate a new object.
Dtk_Line::Create
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
JtwSampleMeshes_1_2
Dtk_ErrorStatus JtwSampleMeshes_1_2(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:49
JtwSampleAsmInstances_3_3
Dtk_ErrorStatus JtwSampleAsmInstances_3_3(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:378
testcreatemesh.hpp
JtwSampleUnits_4_2
Dtk_ErrorStatus JtwSampleUnits_4_2(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:607
DTK_TYPE_EDGE
@ DTK_TYPE_EDGE
Definition: define.h:130
testcreatecube.hpp
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Dtk_transfo::addTranslate
void addTranslate(const Dtk_dir &V)
Translate the Dtk_transfo.
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
MakeReferencePoint
Dtk_BodyPtr MakeReferencePoint()
Definition: testlibjtwrite.cpp:970
Dtk_Jtw_Interface::LastInstance_SetInstanceID
Dtk_ErrorStatus LastInstance_SetInstanceID(Dtk_Int64 inInstanceID)
Set an instance ID to previously opened instance.
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Definition: testcreatecube.cpp:1357
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Definition: testcreatecube.cpp:1434
MakeMultiSection
Dtk_EntityPtr MakeMultiSection()
Definition: testlibjtwrite.cpp:837
JtwSamplePartInstances_3_2
Dtk_ErrorStatus JtwSamplePartInstances_3_2(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:344
MakePmiOnRoot
Dtk_ErrorStatus MakePmiOnRoot(Dtk_Jtw_Interface &J, int option)
Definition: testlibjtwrite.cpp:1147
tess_EndTesselation
void tess_EndTesselation()
Free the data used by tesselation library.
JtwSampleSimpleModelview_5_2
Dtk_ErrorStatus JtwSampleSimpleModelview_5_2(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:735
Dtk_LayerInfosSet::Create
static Dtk_LayerInfosSetPtr Create(const Dtk_Size_t inNumLayers)
Calls a constructor to allocate a new object.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:147
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_Shell::Create
static Dtk_ShellPtr Create(const Dtk_BodyPtr &inParentBody)
Create a shell in a body.
Dtk_mesh_face::info
Dtk_InfoPtr & info()
acces to class info of mesh_face
Dtk_Jtw_Interface
This is Jt Interface class used to write Jt files.
Definition: jtw.h:21
CreateModelDisplay
Dtk_ModelDisplayPtr CreateModelDisplay(const Dtk_string &name)
Definition: testlibjtwrite.cpp:1070
testwriters.h
Dtk_Jtw_Interface::AddMesh
Dtk_ErrorStatus AddMesh(const Dtk_MeshPtr &inToWrite, Dtk_Float32 inLossytol=0)
Add a mesh into the current node.
Dtk_RGB
Definition: dtk_rgb.hpp:7
AllJtWTests
int AllJtWTests(const Dtk_string &inResultDirectory)
Definition: testlibjtwrite.cpp:1240
JtwSampleMultipleFilesPerPart_3_6
Dtk_ErrorStatus JtwSampleMultipleFilesPerPart_3_6(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:505
JtwSamplePMI_PMI_association_5_6
Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:894
Dtk_Info::create
static Dtk_SmartPtr< Dtk_Info > create()
Calls default constructor to allocate a new object.
Dtk_Jtw_Interface::ConnectPMI_ModelView
Dtk_ErrorStatus ConnectPMI_ModelView(Dtk_Int64 inIdpmi, Dtk_Int64 inIdModelView, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >())
Connect a PMI on a ModelView.
Dtk_Jtw_Interface::ConnectPMI_PMI
Dtk_ErrorStatus ConnectPMI_PMI(Dtk_Int64 inIdpmifrom, Dtk_Int64 inIdpmito, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >())
Connect a PMI on another PMI.
Dtk_Jtw_Interface::AddLayerInfosSet
Dtk_ErrorStatus AddLayerInfosSet(const Dtk_LayerInfosSetPtr &inToWrite)
Add a Layer informations.
Dtk_Jtw_Interface::AddReferenceGeometry
Dtk_ErrorStatus AddReferenceGeometry(const Dtk_BodyPtr &inRefgeom, Dtk_Int64 inIdrefgeom=-1)
Add a reference geometry into the current node.
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
Dtk_Jtw_Interface::ConnectModelView_Instance
Dtk_ErrorStatus ConnectModelView_Instance(Dtk_Int64 inIdmodelview, const Dtk_tab< Dtk_Int64 > &inRoute, int inHide=0, Dtk_ID inBodyID=0, const Dtk_transfo *const inExplode_absolute=NULL)
Connect a ModelView on an Instance, for part representation restriction in a modelview.
Dtk_Jtw_Interface::overwritecolor
@ overwritecolor
Definition: jtw.h:31
JtwSampleModelViewAsm_6_1
Dtk_ErrorStatus JtwSampleModelViewAsm_6_1(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:1082
Dtk_Jtw_Interface::AddBody
Dtk_ErrorStatus AddBody(const Dtk_BodyPtr &inToWrite, const Dtk_tab< Dtk_Float32 > &makelods=Dtk_tab< Dtk_Float32 >(), Dtk_Float32 inLossytol=0)
Add a body into the current node.
JtwSampleBodyVisibility_2_4
Dtk_ErrorStatus JtwSampleBodyVisibility_2_4(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:208
Makeroute
Dtk_tab< Dtk_Int64 > Makeroute(Dtk_Int64 r[], int nb)
Definition: testlibjtwrite.cpp:1127
Shift
void Shift(T &mesh, double sh)
Definition: testlibjtwrite.cpp:42
Dtk_mesh_face::add_triangles
int add_triangles(Dtk_tab< Dtk_UInt32 > *inIndices)
Add one of multiple triangles.
JtwSampleTextures_1_3
Dtk_ErrorStatus JtwSampleTextures_1_3(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:130
Dtk_MetaData::CreateMetaData
static Dtk_MetaDataPtr CreateMetaData(const MetaDataTypeEnum &inEnumType, Dtk_string inTitle, Dtk_string inValue, Dtk_string inValueType=Dtk_string(L"STRING"))
Create a Dtk_MetaDataPtr .
Dtk_Entity::info
Dtk_InfoPtr & info()