DATAKIT SDK  V2026.1
testlibjtwrite.cpp File Reference

Functions

void AddVertex (Dtk_MeshPtr mesh, const Dtk_pnt &P, const Dtk_dir &N, float u, float v)
 
int AllJtWTests (const Dtk_string &inResultDirectory)
 
Dtk_FdtPtr CreateFdtDatumAt (const Dtk_pnt &D)
 
Dtk_LayerInfosSetPtr CreateLayerInfosSet ()
 
Dtk_ModelDisplayPtr CreateModelDisplay (const Dtk_string &name)
 
Dtk_MeshPtr CreateTextureMesh ()
 
int JtWriteSample (const Dtk_string &inResultDirectory)
 
Dtk_ErrorStatus JtwSampleAsmInstances_3_3 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleAssembly_3_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleAxis_References_5_7 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleBody_2_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleBodyLOD_2_2 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleBodyVisibility_2_4 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleInstancesColors_3_4 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleInstancesVisibily_3_5 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleLayerNames_4_5 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleLayers_4_4 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleLightmap_2_5 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleMeshes_1_2 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleMetadatas_4_3 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleModelview_sections_5_5 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleModelViewAsm_6_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleModelViewTarget_6_2 (const Dtk_string &outputFileName, int option)
 
Dtk_ErrorStatus JtwSampleMultipleFilesPerPart_3_6 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleMultipleFilesShattered_3_7 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleOneMesh_1_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSamplePartInstances_3_2 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_Geom_association_5_4 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_Geom_one_association_5_8 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_MV_association_5_3 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleSimpleModelview_5_2 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleSimplePMI_5_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleTextures_1_3 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleUnits_4_2 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleVersion_4_1 (const Dtk_string &outputFileName)
 
Dtk_ErrorStatus JtwSampleWireBody_2_3 (const Dtk_string &outputFileName)
 
Dtk_EntityPtr MakeMultiSection ()
 
Dtk_ErrorStatus MakePmiOnRoot (Dtk_Jtw_Interface &J, int option)
 
Dtk_BodyPtr MakeReferenceAxis ()
 
Dtk_BodyPtr MakeReferencePlane ()
 
Dtk_BodyPtr MakeReferencePoint ()
 
Dtk_tab< Dtk_Int64Makeroute (Dtk_Int64 r[], int nb)
 
Dtk_ErrorStatus SampleLossyCompression_2_6 (const Dtk_string &outputFileName)
 
void SetLightMapOnOneFace (Dtk_BodyPtr &body, const Dtk_RGB &ambiant, const Dtk_RGB &diffuse, const Dtk_RGB &specular, float shininess)
 
template<typename T >
void Shift (T &mesh, double sh)
 

Function Documentation

◆ AddVertex()

void AddVertex ( Dtk_MeshPtr  mesh,
const Dtk_pnt P,
const Dtk_dir N,
float  u,
float  v 
)
95 {
96  mesh->add_vertex( &P, &N, NULL, u, v );
97 }

◆ AllJtWTests()

int AllJtWTests ( const Dtk_string inResultDirectory)
1241 {
1242  Dtk_ErrorStatus errorStatus;
1243  Dtk_string outputDirectory, outputFileName;
1244  // Choosing output directory and file name
1245  outputDirectory = inResultDirectory + L"Jt/";
1246  outputDirectory.FixPathSeparator();
1247  outputDirectory.mkdir();
1248 
1249  // samples meshes
1250  outputFileName = outputDirectory + L"JTW_1_1_SampleMesh.jt";
1251  errorStatus = JtwSampleOneMesh_1_1( outputFileName );
1252  outputFileName = outputDirectory + L"JTW_1_2_SampleMeshes.jt";
1253  errorStatus = JtwSampleMeshes_1_2( outputFileName );
1254  outputFileName = outputDirectory + L"JTW_1_3_SampleTextures.jt";
1255  errorStatus = JtwSampleTextures_1_3( outputFileName );
1256 
1257  outputFileName = outputDirectory + L"JTW_2_1_SampleBody.jt";
1258  errorStatus = JtwSampleBody_2_1( outputFileName);
1259  outputFileName = outputDirectory + L"JTW_2_2_SampleBodyLOD.jt";
1260  errorStatus = JtwSampleBodyLOD_2_2( outputFileName );
1261  outputFileName = outputDirectory + L"JTW_2_3_SampleWireBody.jt";
1262  errorStatus = JtwSampleWireBody_2_3( outputFileName );
1263  outputFileName = outputDirectory + L"JTW_2_4_SampleBodyVisibility.jt";
1264  errorStatus = JtwSampleBodyVisibility_2_4( outputFileName );
1265  outputFileName = outputDirectory + L"JTW_2_5_SampleLightmap.jt";
1266  errorStatus = JtwSampleLightmap_2_5( outputFileName );
1267  outputFileName = outputDirectory + L"JTW_2_6_SampleLossy.jt";
1268  errorStatus = SampleLossyCompression_2_6( outputFileName );
1269 
1270  outputFileName = outputDirectory + L"JTW_3_1_SampleAssembly.jt";
1271  errorStatus = JtwSampleAssembly_3_1( outputFileName );
1272  outputFileName = outputDirectory + L"JTW_3_2_SamplePartInstances.jt";
1273  errorStatus = JtwSamplePartInstances_3_2( outputFileName );
1274  outputFileName = outputDirectory + L"JTW_3_3_SampleAsmInstances.jt";
1275  errorStatus = JtwSampleAsmInstances_3_3( outputFileName );
1276  outputFileName = outputDirectory + L"JTW_3_4_SampleInstancesColors.jt";
1277  errorStatus = JtwSampleInstancesColors_3_4( outputFileName );
1278  outputFileName = outputDirectory + L"JTW_3_5_SampleInstancesVisibily.jt";
1279  errorStatus = JtwSampleInstancesVisibily_3_5( outputFileName );
1280  outputFileName = outputDirectory + L"JTW_3_6_SampleMultipleFilesPerPart.jt";
1281  errorStatus = JtwSampleMultipleFilesPerPart_3_6( outputFileName );
1282  outputFileName = outputDirectory + L"JTW_3_7_SampleMultipleFilesShattered.jt";
1283  errorStatus = JtwSampleMultipleFilesShattered_3_7( outputFileName );
1284 
1285  outputFileName = outputDirectory + L"JTW_4_1_SampleVersion.jt";
1286  errorStatus = JtwSampleVersion_4_1( outputFileName );
1287  outputFileName = outputDirectory + L"JTW_4_2_SampleUnits.jt";
1288  errorStatus = JtwSampleUnits_4_2( outputFileName );
1289  outputFileName = outputDirectory + L"JTW_4_3_SampleMetadatas.jt";
1290  errorStatus = JtwSampleMetadatas_4_3( outputFileName );
1291  outputFileName = outputDirectory + L"JTW_4_4_SampleLayers.jt";
1292  errorStatus = JtwSampleLayers_4_4( outputFileName );
1293  outputFileName = outputDirectory + L"JTW_4_5_SampleLayerNames.jt";
1294  errorStatus = JtwSampleLayerNames_4_5( outputFileName );
1295 
1296  outputFileName = outputDirectory + L"JTW_5_1_SampleSimplePMI.jt";
1297  errorStatus = JtwSampleSimplePMI_5_1( outputFileName );
1298  outputFileName = outputDirectory + L"JTW_5_2_SampleSimpleModelview.jt";
1299  errorStatus = JtwSampleSimpleModelview_5_2( outputFileName );
1300  outputFileName = outputDirectory + L"JTW_5_3_SamplePMI_MV_association.jt";
1301  errorStatus = JtwSamplePMI_MV_association_5_3( outputFileName );
1302  outputFileName = outputDirectory + L"JTW_5_4_SamplePMI_Geom_association.jt";
1303  errorStatus = JtwSamplePMI_Geom_association_5_4( outputFileName);
1304  outputFileName = outputDirectory + L"JTW_5_5_SampleModelview_sections.jt";
1305  errorStatus = JtwSampleModelview_sections_5_5( outputFileName );
1306  outputFileName = outputDirectory + L"JTW_5_6_SamplePMI_PMI_association.jt";
1307  errorStatus = JtwSamplePMI_PMI_association_5_6( outputFileName );
1308  outputFileName = outputDirectory + L"JTW_5_7_SampleAxis_References.jt";
1309  errorStatus = JtwSampleAxis_References_5_7( outputFileName );
1310  outputFileName = outputDirectory + L"JTW_5_8_SamplePMI_Geom_one_association.jt";
1311  errorStatus = JtwSamplePMI_Geom_one_association_5_8( outputFileName );
1312 
1313  outputFileName = outputDirectory + L"JTW_6_1_SampleModelViewAsm.jt";
1314  errorStatus = JtwSampleModelViewAsm_6_1( outputFileName );
1315  outputFileName = outputDirectory + L"JTW_6_2_SampleModelViewTarget.jt";
1316  errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 1);
1317  outputFileName = outputDirectory + L"JTW_6_3_SampleModelViewRemove.jt";
1318  errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 2);
1319  outputFileName = outputDirectory + L"JTW_6_4_SampleAsmPMITarget.jt";
1320  errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 3);
1321  outputFileName = outputDirectory + L"JTW_6_5_SampleAsmExplodedView.jt";
1322  errorStatus = JtwSampleModelViewTarget_6_2( outputFileName, 4 );
1323 
1324  return errorStatus;
1325 }

◆ CreateFdtDatumAt()

Dtk_FdtPtr CreateFdtDatumAt ( const Dtk_pnt D)
1136 {
1138  double scale = 0.1;
1139  Dtk_transfo rescale(Dtk_dir(scale, 0, 0), Dtk_dir(0, scale, 0), Dtk_dir(0, 0, scale), scale * Dtk_pnt(-50., -100., -50.));
1140  pmi->Transform(rescale);
1141  Dtk_transfo shift;
1142  shift.addTranslate(D);
1143  pmi->Transform(shift);
1144  return pmi;
1145 }

◆ CreateLayerInfosSet()

Dtk_LayerInfosSetPtr CreateLayerInfosSet ( )
675 {
676  Dtk_LayerInfosSetPtr lay = Dtk_LayerInfosSet::Create(2); // 2 layers
677  lay->SetLayerID(0, 3); // layer 0 has ID 3
678  lay->SetLayerID(1, 5); // layer 1 has ID 5
679  lay->SetLayerName(0, "LayerThree");
680  lay->SetLayerName(1, "LayerFive");
681  return lay;
682 }

◆ CreateModelDisplay()

Dtk_ModelDisplayPtr CreateModelDisplay ( const Dtk_string name)
1071 {
1072  Dtk_pnt from(300, 300, 300);
1073  Dtk_pnt to(0, 0, 0);
1074  Dtk_dir up(-0.57735, 0.57735, -0.57735);
1075  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 5, 5, up);
1076  Dtk_ModelDisplayPtr mv = Dtk_ModelDisplay::Create(cam, NULL, 1);
1077  mv->info() = Dtk_Info::create();
1078  mv->info()->SetName(name);
1079  return mv;
1080 }

◆ CreateTextureMesh()

Dtk_MeshPtr CreateTextureMesh ( )
100 {
102  Dtk_mesh_face* mf = new Dtk_mesh_face( mesh.operator->() );
103  mesh->add_mesh_face( mf );
104  AddVertex( mesh, Dtk_pnt( 0, 0, 0 ), Dtk_dir( 0, 0, 1 ), 0, 0 );
105  AddVertex( mesh, Dtk_pnt( 10, 0, 0 ), Dtk_dir( 0, 0, 1 ), 1, 0 );
106  AddVertex( mesh, Dtk_pnt( 10, 10, 0 ), Dtk_dir( 0, 0, 1 ), 1, 1 );
107  AddVertex( mesh, Dtk_pnt( 0, 10, 0 ), Dtk_dir( 0, 0, 1 ), 0, 1 );
108  Dtk_tab<Dtk_ID> inds;
109  inds.push_back( 0 ); inds.push_back( 1 ); inds.push_back( 2 );
110  inds.push_back( 0 ); inds.push_back( 2 ); inds.push_back( 3 );
111  mf->add_triangles(&inds );
112 // texture
113  Dtk_picture picture;
114  picture.MetricHeight() = picture.MetricWidth() = 256;
115  picture.PixelWidth() = 256;
116  picture.PixelHeight() = 256;
117  picture.FileType() = DTK_PICTURE_RGB24;
118  picture.File().resize( 256 * 256 * 3 );
119  size_t i, size = picture.File().size();
120  for( i = 0; i < size; i++ ) // make "random" pixels
121  picture.File()[ i ] = ( i * i + i / 256 ) % 256;
123  texture->SetTextureImage( &picture );
124  Dtk_RenderInfosPtr render = Dtk_RenderInfos::Create( "uselessname", NULL, texture );
125  mf->info() = Dtk_Info::create();
126  mf->info()->AddRenderInfos( render );
127  return mesh;
128 }

◆ JtWriteSample()

int JtWriteSample ( const Dtk_string inResultDirectory)
1330 {
1331  cout << endl << "----------------------------------------------" << endl;
1332  cout <<"Jt Write start" << endl;
1333 
1334  tess_InitTesselation("./", 0.005); // Init Tessellation : working directory and default tolerance (needed for writing bodies)
1335  tess_ComputeBoundariesFromMesh(0); // Disable wire creation on mesh during Brep tessellation.
1336 
1337  int err = AllJtWTests(inResultDirectory); // all tests.
1338 
1339  tess_EndTesselation(); // End of tessellation
1340  cout <<"Jt Write end" << endl;
1341 
1342 
1343  return err;
1344 }

◆ JtwSampleAsmInstances_3_3()

Dtk_ErrorStatus JtwSampleAsmInstances_3_3 ( const Dtk_string outputFileName)
379 {
380  Dtk_dir X(1, 0, 0);
381  Dtk_dir Y(0, 1, 0);
382  Dtk_dir Z(0, 0, 1);
383  Dtk_ErrorStatus err;
384  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
385  CHECK_OK(err);
386  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
387 
388  Dtk_Int64 id_of_axles = 2;
389  CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
390 
391  CHECK_OK(J.OpenInstance("Axle")); // open
392  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
393  CHECK_OK(J.AddBody(axle));
394  CHECK_OK(J.CloseLastInstance()); // close Axle
395 
396  CHECK_OK(J.OpenInstance("Wheels")); // open
397  Dtk_Int64 id_of_wheel = 1;
398  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
399  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
400  CHECK_OK(J.AddBody(wheel));
401  CHECK_OK(J.CloseLastInstance()); // close Wheel
402 
403  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
404  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
405 
406  CHECK_OK(J.CloseLastInstance()); // close Wheels
407 
408  CHECK_OK(J.CloseLastInstance()); // close Axles
409 
410  CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
411  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
412 
413  CHECK_OK(J.CloseLastInstance()); // close RootNode
414  cout << "=> " << outputFileName.c_str() << endl;
415  return dtkNoError;// Automatic Finish while J released
416 }

◆ JtwSampleAssembly_3_1()

Dtk_ErrorStatus JtwSampleAssembly_3_1 ( const Dtk_string outputFileName)
311 {
312  Dtk_ErrorStatus err;
313  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
314  CHECK_OK(err);
315  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
316 
317  CHECK_OK(J.OpenInstance("Axle")); // open
318  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
319  CHECK_OK(J.AddBody(axle));
320  CHECK_OK(J.CloseLastInstance()); // close Axle
321 
322  CHECK_OK(J.OpenInstance("Wheels")); // open
323 
324  CHECK_OK(J.OpenInstance("Wheel")); // open
325  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
326  Shift(wheel, 2);
327  CHECK_OK(J.AddBody(wheel));
328  CHECK_OK(J.CloseLastInstance()); // close Wheel
329 
330  CHECK_OK(J.OpenInstance("Wheel2")); // open
331  Shift(wheel, 3);
332  CHECK_OK(J.AddBody(wheel));
333  CHECK_OK(J.CloseLastInstance()); // close Wheel
334 
335  CHECK_OK(J.CloseLastInstance()); // close Wheels
336 
337  CHECK_OK(J.CloseLastInstance()); // close RootNode
338  cout << "=> " << outputFileName.c_str() << endl;
339  return dtkNoError;// Automatic Finish while J released
340 }

◆ JtwSampleAxis_References_5_7()

Dtk_ErrorStatus JtwSampleAxis_References_5_7 ( const Dtk_string outputFileName)
987 {
988  Dtk_ErrorStatus err;
989  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
990  CHECK_OK(err);
991  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
992 
993  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
994  CHECK_OK(J.AddBody(cylinder)); // Add the body
995 
996  Dtk_pnt from(300, 300, 300);
997  Dtk_pnt to(0, 0, 0);
998  Dtk_dir up(-0.57735, 0.57735, -0.57735);
999  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
1000  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
1001  mv2->info() = Dtk_Info::create();
1002  mv2->info()->SetName("SecondView");
1003  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
1004 
1006  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
1007  axis->SetName("MyAxisSystem"); // give a name
1008  CHECK_OK(J.AddAxisSystem(axis, 50)); // give ID 50
1009  CHECK_OK(J.ConnectPMI_ModelView(50, 8)); // Connect AxisSystem 50 to Modelview 8
1010 
1011  Dtk_BodyPtr refplane = MakeReferencePlane();
1012  CHECK_OK(J.AddReferenceGeometry(refplane, 60)); // give ID 60
1013  CHECK_OK(J.ConnectPMI_ModelView(60, 8)); // Connect Referenceplane 50 to Modelview 8
1014 
1015  Dtk_BodyPtr refaxis = MakeReferenceAxis();
1016  CHECK_OK(J.AddReferenceGeometry(refaxis, 70)); // give ID 70
1017  CHECK_OK(J.ConnectPMI_ModelView(70, 8)); // Connect Referenceplane 60 to Modelview 8
1018 
1019  Dtk_BodyPtr refpoint = MakeReferencePoint();
1020  CHECK_OK(J.AddReferenceGeometry(refpoint, 80)); // give ID 80
1021  CHECK_OK(J.ConnectPMI_ModelView(80, 8)); // Connect Referenceplane 70 to Modelview 8
1022 
1023  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
1024  cout << "=> " << outputFileName.c_str() << endl;
1025  return dtkNoError;// Automatic Finish while J released
1026 }

◆ JtwSampleBody_2_1()

Dtk_ErrorStatus JtwSampleBody_2_1 ( const Dtk_string outputFileName)
147 {
148  Dtk_ErrorStatus err;
149  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
150  CHECK_OK(err);
151  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
152  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
153  CHECK_OK(J.AddBody(cylinder)); // Add the body
154  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
155  cout << "=> " << outputFileName.c_str() << endl;
156  return dtkNoError;// Automatic Finish while J released
157 }

◆ JtwSampleBodyLOD_2_2()

Dtk_ErrorStatus JtwSampleBodyLOD_2_2 ( const Dtk_string outputFileName)
162 {
163  Dtk_ErrorStatus err;
164  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
165  CHECK_OK(err);
166  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
167 
168  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
169  CHECK_OK(J.AddBody(cylinder)); // Add the body, tessellated as default tess_InitTesselation value
170 
171  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(1, 2); // Create another Cylinder radius=1, height=2 (with a green face)
172  Shift(cylinder2, 3); // shift the cylinder, see exemple above
173  Dtk_tab<Dtk_Float32> lods; // create a LOD array
174  lods.push_back(0.001f); lods.push_back(-1); // Highest LOD : linear tol = 0.001, angular automatic
175  lods.push_back(0.01f); lods.push_back(-1); // Medium LOD : linear tol = 0.01, angular automatic
176  lods.push_back(0.1f); lods.push_back(-1); // Lower LOD : linear tol = 0.1, angular automatic
177  CHECK_OK(J.AddBody(cylinder2, lods)); // add the body, will tessellate automaticly for LODS.
178 
179  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
180  cout << "=> " << outputFileName.c_str() << endl;
181  return dtkNoError;// Automatic Finish while J released
182 }

◆ JtwSampleBodyVisibility_2_4()

Dtk_ErrorStatus JtwSampleBodyVisibility_2_4 ( const Dtk_string outputFileName)
209 {
210  Dtk_ErrorStatus err;
211  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
212  CHECK_OK(err);
213  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
214 
215  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2);
216  CHECK_OK(J.AddBody(cylinder));
217 
218  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(1, 2);
219  Shift(cylinder2, 3);
220  CHECK_OK(J.AddBody(cylinder2));
221 
222  Dtk_BodyPtr cylinder3 = sampleWriter::CreateCyl(1, 2);
223  Shift(cylinder3, 6);
224  cylinder3->info()->SetBlankedStatus(DTK_TRUE);
225  CHECK_OK(J.AddBody(cylinder3));
226 
227  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
228  cout << "=> " << outputFileName.c_str() << endl;
229  return dtkNoError;// Automatic Finish while J released
230 }

◆ JtwSampleInstancesColors_3_4()

Dtk_ErrorStatus JtwSampleInstancesColors_3_4 ( const Dtk_string outputFileName)
422 {
423  Dtk_dir X(1, 0, 0);
424  Dtk_dir Y(0, 1, 0);
425  Dtk_dir Z(0, 0, 1);
426  Dtk_ErrorStatus err;
427  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
428  CHECK_OK(err);
429  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
430 
431  Dtk_Int64 id_of_axles = 2;
432  CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
433 
434  CHECK_OK(J.OpenInstance("Axle")); // open
435  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
436  CHECK_OK(J.AddBody(axle));
437  CHECK_OK(J.CloseLastInstance()); // close Axle
438 
439  CHECK_OK(J.OpenInstance("Wheels")); // open
440  Dtk_Int64 id_of_wheel = 1;
441  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
442  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
443  CHECK_OK(J.AddBody(wheel));
444  CHECK_OK(J.CloseLastInstance()); // close Wheel
445 
446  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
447  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
448 
449  CHECK_OK(J.CloseLastInstance()); // close Wheels
450 
451  CHECK_OK(J.CloseLastInstance()); // close Axles
452 
453  CHECK_OK(J.OpenInstance("Axles2", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(5, 0, 0))));
454  CHECK_OK(J.LastInstance_SetInstanceColor(Dtk_RGB(255, 0, 0, 128), Dtk_Jtw_Interface::keepsubcolor));
455  // Give a RED color with transparence, with keepsubcolor strategy : only uncolored faces are filled
456  CHECK_OK(J.CloseLastInstance()); // close Axles2
457 
458  CHECK_OK(J.OpenInstance("Axles3", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0))));
459  CHECK_OK(J.LastInstance_SetInstanceColor(Dtk_RGB(0, 0, 255), Dtk_Jtw_Interface::overwritecolor));
460  // Give a BLUE color, with overwrite color strategy : all faces are filled
461  CHECK_OK(J.CloseLastInstance()); // close Axles2
462 
463  CHECK_OK(J.CloseLastInstance()); // close RootNode
464  cout << "=> " << outputFileName.c_str() << endl;
465  return dtkNoError;// Automatic Finish while J released
466 }

◆ JtwSampleInstancesVisibily_3_5()

Dtk_ErrorStatus JtwSampleInstancesVisibily_3_5 ( const Dtk_string outputFileName)
471 {
472  Dtk_dir X(1, 0, 0);
473  Dtk_dir Y(0, 1, 0);
474  Dtk_dir Z(0, 0, 1);
475  Dtk_ErrorStatus err;
476  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
477  CHECK_OK(err);
478  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
479 
480  CHECK_OK(J.OpenInstance("Axle")); // open
481  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
482  CHECK_OK(J.AddBody(axle));
483  CHECK_OK(J.CloseLastInstance()); // close Axle
484 
485  CHECK_OK(J.OpenInstance("Wheels")); // open
486  Dtk_Int64 id_of_wheel = 1;
487  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
488  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
489  CHECK_OK(J.AddBody(wheel));
490  CHECK_OK(J.CloseLastInstance()); // close Wheel
491 
492  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt())));
493  CHECK_OK(J.LastInstance_SetInvisible()); // Set as invisible
494  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
495 
496  CHECK_OK(J.CloseLastInstance()); // close Wheels
497 
498  CHECK_OK(J.CloseLastInstance()); // close RootNode
499  cout << "=> " << outputFileName.c_str() << endl;
500  return dtkNoError;// Automatic Finish while J released
501 }

◆ JtwSampleLayerNames_4_5()

Dtk_ErrorStatus JtwSampleLayerNames_4_5 ( const Dtk_string outputFileName)
685 {
686  Dtk_ErrorStatus err;
687  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
688  CHECK_OK(err);
689  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
690 
692  CHECK_OK(J.AddLayerInfosSet(lay));
693 
694  CHECK_OK(J.OpenInstance("Cyl1"));
695  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2);
696  cylinder->info()->SetLayer(3);
697  CHECK_OK(J.AddBody(cylinder)); // Add the body
698  CHECK_OK(J.CloseLastInstance());
699 
700  CHECK_OK(J.OpenInstance("Cyl2"));
701  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(1, 2);
702  cylinder2->info()->SetLayer(5);
703  Shift(cylinder2, 3);
704  CHECK_OK(J.AddBody(cylinder2)); // Add the body
705  CHECK_OK(J.CloseLastInstance());
706 
707  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
708  cout << "=> " << outputFileName.c_str() << endl;
709  return dtkNoError;// Automatic Finish while J released
710 }

◆ JtwSampleLayers_4_4()

Dtk_ErrorStatus JtwSampleLayers_4_4 ( const Dtk_string outputFileName)
647 {
648  Dtk_ErrorStatus err;
649  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
650  CHECK_OK(err);
651  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
652 
653  CHECK_OK(J.OpenInstance("Cyl1"));
654  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2);
655  cylinder->info()->SetLayer(3);
656  CHECK_OK(J.AddBody(cylinder)); // Add the body
657  CHECK_OK(J.CloseLastInstance());
658 
659  CHECK_OK(J.OpenInstance("Cyl2"));
660  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(1, 2);
661  cylinder2->info()->SetLayer(5);
662  Shift(cylinder2, 3);
663  CHECK_OK(J.AddBody(cylinder2)); // Add the body
664  CHECK_OK(J.CloseLastInstance());
665 
666  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
667  cout << "=> " << outputFileName.c_str() << endl;
668  return dtkNoError;// Automatic Finish while J released
669 }

◆ JtwSampleLightmap_2_5()

Dtk_ErrorStatus JtwSampleLightmap_2_5 ( const Dtk_string outputFileName)
254 {
255  Dtk_ErrorStatus err;
256  Dtk_Jtw_Interface J( outputFileName, err, Dtk_Jtw_Interface::xtbrep ); // Specify allowing BREP Writing
257  CHECK_OK( err );
258  CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
259 
260  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 1, 2 );
261  SetLightMapOnOneFace( cylinder, Dtk_RGB( 50, 50, 50 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 0, 0, 255 ), 0 );
262  CHECK_OK( J.AddBody( cylinder ) );
263 
264  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl( 1, 2 );
265  Shift( cylinder2, 3 );
266  SetLightMapOnOneFace( cylinder2, Dtk_RGB( 50, 50, 50 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 0, 0, 0 ), 0.5 );
267  CHECK_OK( J.AddBody( cylinder2 ) );
268 
269  Dtk_BodyPtr cylinder3 = sampleWriter::CreateCyl( 1, 2 );
270  Shift( cylinder3, 6 );
271  SetLightMapOnOneFace( cylinder3, Dtk_RGB( 100, 50, 30 ), Dtk_RGB( 255, 0, 0 ), Dtk_RGB( 255, 255, 255 ), 1 );
272  CHECK_OK( J.AddBody( cylinder3 ) );
273 
274  CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
275  cout << "=> " << outputFileName.c_str() << endl;
276  return dtkNoError;// Automatic Finish while J released
277 }

◆ JtwSampleMeshes_1_2()

Dtk_ErrorStatus JtwSampleMeshes_1_2 ( const Dtk_string outputFileName)
50 {
51  Dtk_ErrorStatus err;
52  Dtk_Jtw_Interface J(outputFileName, err);
53  CHECK_OK(err);
54  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
55 
56  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
57  CHECK_OK(J.AddMesh(CubeMesh)); // write the cube (A)
58 
59  Dtk_MeshPtr CubePervertexColorMesh = sampleWriter::CreateMeshCubeVertexColor(); // create a per vertex color cube
60  Shift(CubePervertexColorMesh, 3); // translate it not to be on previous geometry
61  CHECK_OK(J.AddMesh(CubePervertexColorMesh)); // (B)
62 
63  Dtk_MeshPtr TransparentCube = sampleWriter::CreateMeshCube(); // create a simple red cube
64  TransparentCube->info()->SetColor(Dtk_RGB(0, 255, 0, 128)); // set whole cube as green and transparent
65  Shift(TransparentCube, 6); // translate it not to be on previous geometry
66  CHECK_OK(J.AddMesh(TransparentCube)); // (C)
67 
68  Dtk_MeshPtr TransparentOneFaceCube = sampleWriter::CreateMeshCube(); // create a simple red cube
69  if (TransparentOneFaceCube->get_nb_mesh_face() == 6)
70  {
71  if (TransparentOneFaceCube->get_mesh_face(3)->info().IsNULL())
72  TransparentOneFaceCube->get_mesh_face(3)->info() = Dtk_Info::create();
73  TransparentOneFaceCube->get_mesh_face(3)->info()->SetColor(Dtk_RGB(0, 0, 255, 128)); // set face 3 as blue and transparent
74  }
75  Shift(TransparentOneFaceCube, 9); // translate it not to be on previous geometry (D)
76  CHECK_OK(J.AddMesh(TransparentOneFaceCube));
77 
78  Dtk_MeshPtr MeshWire = sampleWriter::CreateMeshWire(); // create wire mesh
79  Shift(MeshWire, 12); // translate it not to be on previous geometry
80  CHECK_OK(J.AddMesh(MeshWire)); // (E)
81 
82  Dtk_MeshPtr MeshPoints = sampleWriter::CreateMeshPoints(); // create a mesh wich contain only orange points.
83  Shift(MeshPoints, 15); // translate it not to be on previous geometry
84  CHECK_OK(J.AddMesh(MeshPoints)); // (F)
85 
86  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
87  cout << "=> " << outputFileName.c_str() << endl;
88  return dtkNoError; // Automatic Finish while J released
89 }

◆ JtwSampleMetadatas_4_3()

Dtk_ErrorStatus JtwSampleMetadatas_4_3 ( const Dtk_string outputFileName)
625 {
626  Dtk_ErrorStatus err;
627  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
628  CHECK_OK(err);
629  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
630 
632  CHECK_OK(J.AddMetaData(meta));
633 
634  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(1, 2); // Create a Cylinder radius=1, height=2 (with a green face)
635  CHECK_OK(J.AddBody(cylinder)); // Add the body
636 
637  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
638  cout << "=> " << outputFileName.c_str() << endl;
639  return dtkNoError;// Automatic Finish while J released
640 }

◆ JtwSampleModelview_sections_5_5()

Dtk_ErrorStatus JtwSampleModelview_sections_5_5 ( const Dtk_string outputFileName)
858 {
859  Dtk_ErrorStatus err;
860  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
861  CHECK_OK(err);
862  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
863 
864  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
865  CHECK_OK(J.AddBody(cylinder)); // Add the body
866 
867  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
868  CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
869 
870  Dtk_pnt from(300, 300, 300);
871  Dtk_pnt to(0, 0, 0);
872  Dtk_dir up(-0.57735, 0.57735, -0.57735);
873  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
874  Dtk_PlaneSurfacePtr section = Dtk_PlaneSurface::Create(Dtk_pnt(), Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0)); // (A)
875  //Dtk_EntityPtr section = MakeMultiSection(); // (B)
877 
878  mv2->info() = Dtk_Info::create();
879  mv2->info()->SetName("SecondView");
880  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
881 
882  CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
883 
884  CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE)); // Connect PMI 5 on body, on face ID= 2
885  CHECK_OK(J.ConnectPMI_Geom(5, 15, DTK_TYPE_EDGE)); // Connect PMI 5 on body, on edge ID= 15
886 
887  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
888  cout << "=> " << outputFileName.c_str() << endl;
889  return dtkNoError;// Automatic Finish while J released
890 }

◆ JtwSampleModelViewAsm_6_1()

Dtk_ErrorStatus JtwSampleModelViewAsm_6_1 ( const Dtk_string outputFileName)
1083 {
1084  Dtk_dir X(1, 0, 0);
1085  Dtk_dir Y(0, 1, 0);
1086  Dtk_dir Z(0, 0, 1);
1087  Dtk_ErrorStatus err;
1088  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
1089  CHECK_OK(err);
1090  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
1091 
1092  Dtk_Int64 id_of_axles = 2;
1093  CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
1094 
1095  CHECK_OK(J.OpenInstance("Axle")); // open
1096  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
1097  CHECK_OK(J.AddBody(axle));
1098  CHECK_OK(J.AddModelView(CreateModelDisplay("AxleMV"), 8));
1099  CHECK_OK(J.CloseLastInstance()); // close Axle
1100 
1101  CHECK_OK(J.OpenInstance("Wheels")); // open
1102  Dtk_Int64 id_of_wheel = 1;
1103  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
1104  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
1105  CHECK_OK(J.AddBody(wheel));
1106  CHECK_OK(J.AddModelView(CreateModelDisplay("WheelMV"), 8));
1107  CHECK_OK(J.CloseLastInstance()); // close Wheel
1108 
1109  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
1110  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
1111 
1112  CHECK_OK(J.CloseLastInstance()); // close Wheels
1113 
1114  CHECK_OK(J.CloseLastInstance()); // close Axles
1115 
1116  CHECK_OK(J.OpenInstance("Axles2", id_of_axles, Dtk_transfo(X, Y, Z, Dtk_pnt(5, 0, 0)))); // reinstance whole subassembly with matrix
1117  CHECK_OK(J.CloseLastInstance()); // close Axles2
1118 
1119  CHECK_OK(J.AddModelView(CreateModelDisplay("RootMV"), 8));
1120  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
1121  cout << "=> " << outputFileName.c_str() << endl;
1122  return dtkNoError;// Automatic Finish while J released
1123 }

◆ JtwSampleModelViewTarget_6_2()

Dtk_ErrorStatus JtwSampleModelViewTarget_6_2 ( const Dtk_string outputFileName,
int  option 
)
1200 {
1201  Dtk_dir X(1, 0, 0);
1202  Dtk_dir Y(0, 1, 0);
1203  Dtk_dir Z(0, 0, 1);
1204  Dtk_ErrorStatus err;
1205  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
1206  CHECK_OK(err);
1207  CHECK_OK(J.OpenInstance("RootNode", 1)); // Rootnode creation
1208  CHECK_OK(J.OpenInstance("Axles", 2));
1209  CHECK_OK(J.LastInstance_SetInstanceID(11));
1210  CHECK_OK(J.OpenInstance("Axle", 3));
1211  CHECK_OK(J.LastInstance_SetInstanceID(12));
1212  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
1213  CHECK_OK(J.AddBody(axle));
1214  CHECK_OK(J.CloseLastInstance()); // close Axle
1215  CHECK_OK(J.OpenInstance("Wheels", 4));
1216  CHECK_OK(J.LastInstance_SetInstanceID(13));
1217  CHECK_OK(J.OpenInstance("Wheel", 5, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5))));
1218  CHECK_OK(J.LastInstance_SetInstanceID(14));
1219  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
1220  CHECK_OK(J.AddBody(wheel));
1221  CHECK_OK(J.CloseLastInstance()); // close Wheel
1222  CHECK_OK(J.OpenInstance("Wheel2", 5, Dtk_transfo(X, -Y, -Z, Dtk_pnt())));
1223  CHECK_OK(J.LastInstance_SetInstanceID(15));
1224  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel2 immediatly.
1225  CHECK_OK(J.CloseLastInstance()); // close Wheels
1226  CHECK_OK(J.CloseLastInstance()); // close Axles
1227  CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(6, 0, 0))));
1228  CHECK_OK(J.LastInstance_SetInstanceID(16));
1229  CHECK_OK(J.CloseLastInstance()); // close Axles2
1230  MakePmiOnRoot(J, option);
1231  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
1232  cout << "=> " << outputFileName.c_str() << endl;
1233  return dtkNoError;// Automatic Finish while J released
1234 }

◆ JtwSampleMultipleFilesPerPart_3_6()

Dtk_ErrorStatus JtwSampleMultipleFilesPerPart_3_6 ( const Dtk_string outputFileName)
506 {
507  Dtk_dir X(1, 0, 0);
508  Dtk_dir Y(0, 1, 0);
509  Dtk_dir Z(0, 0, 1);
510  Dtk_ErrorStatus err;
511  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
512  CHECK_OK(err);
513  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
514 
515  Dtk_Int64 id_of_axles = 2;
516  CHECK_OK(J.OpenInstance("Axles", id_of_axles)); // open Axles, give an ID for future reinstance, placement by default : identity matrix
517 
518  CHECK_OK(J.OpenInstance("Axle",Dtk_transfo(), "assembly/axle.jt"));// open instance in a new file.
519  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
520  CHECK_OK(J.AddBody(axle));
521  CHECK_OK(J.CloseLastInstance()); // close Axle
522 
523  CHECK_OK(J.OpenInstance("Wheels")); // open
524  Dtk_Int64 id_of_wheel = 1;
525  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)), "assembly/wheel.jt"));
526  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
527  CHECK_OK(J.AddBody(wheel));
528  CHECK_OK(J.CloseLastInstance()); // close Wheel
529 
530  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
531  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
532 
533  CHECK_OK(J.CloseLastInstance()); // close Wheels
534 
535  CHECK_OK(J.CloseLastInstance()); // close Axles
536 
537  CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
538  CHECK_OK(J.CloseLastInstance()); // close Axles2
539 
540  CHECK_OK(J.CloseLastInstance()); // close RootNode
541  cout << "=> " << outputFileName.c_str() << endl;
542  return dtkNoError;// Automatic Finish while J released
543 }

◆ JtwSampleMultipleFilesShattered_3_7()

Dtk_ErrorStatus JtwSampleMultipleFilesShattered_3_7 ( const Dtk_string outputFileName)
549 {
550  Dtk_dir X(1, 0, 0);
551  Dtk_dir Y(0, 1, 0);
552  Dtk_dir Z(0, 0, 1);
553  Dtk_ErrorStatus err;
554  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
555  CHECK_OK(err);
556  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
557 
558  Dtk_Int64 id_of_axles = 2;
559  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.
560 
561  CHECK_OK(J.OpenInstance("Axle", Dtk_transfo(), "shattered_axle.jt")); // open instance in a new file.
562 
563  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
564  CHECK_OK(J.AddBody(axle));
565  CHECK_OK(J.CloseLastInstance()); // close Axle
566 
567  CHECK_OK(J.OpenInstance("Wheels", Dtk_transfo(), "shattered_wheels.jt")); // open instance in a new file.
568  Dtk_Int64 id_of_wheel = 1;
569  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.
570  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
571  CHECK_OK(J.AddBody(wheel));
572  CHECK_OK(J.CloseLastInstance()); // close Wheel
573 
574  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
575  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly."
576 
577  CHECK_OK(J.CloseLastInstance()); // close Wheels
578 
579  CHECK_OK(J.CloseLastInstance()); // close Axles
580 
581  CHECK_OK(J.OpenInstance("Axles2", 2, Dtk_transfo(X, Y, Z, Dtk_pnt(10, 0, 0)))); // reinstance whole subassembly with matrix
582  CHECK_OK(J.CloseLastInstance()); // close Axles2
583 
584  CHECK_OK(J.CloseLastInstance()); // close RootNode
585  cout << "=> " << outputFileName.c_str() << endl;
586  return dtkNoError;// Automatic Finish while J released
587 }

◆ JtwSampleOneMesh_1_1()

Dtk_ErrorStatus JtwSampleOneMesh_1_1 ( const Dtk_string outputFileName)
25 {
26  Dtk_ErrorStatus err;
27  Dtk_Jtw_Interface J(outputFileName, err);
28  CHECK_OK(err);
29  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
30  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
31  CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
32  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
33  cout << "=> " << outputFileName.c_str() << endl;
34  return dtkNoError; // Automatic Finish while J released
35 }

◆ JtwSamplePartInstances_3_2()

Dtk_ErrorStatus JtwSamplePartInstances_3_2 ( const Dtk_string outputFileName)
345 {
346  Dtk_dir X(1, 0, 0);
347  Dtk_dir Y(0, 1, 0);
348  Dtk_dir Z(0, 0, 1);
349  Dtk_ErrorStatus err;
350  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
351  CHECK_OK(err);
352  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
353 
354  CHECK_OK(J.OpenInstance("Axle")); // open
355  Dtk_BodyPtr axle = sampleWriter::CreateCyl(0.2, 5);
356  CHECK_OK(J.AddBody(axle));
357  CHECK_OK(J.CloseLastInstance()); // close Axle
358 
359  CHECK_OK(J.OpenInstance("Wheels")); // open
360  Dtk_Int64 id_of_wheel = 1;
361  CHECK_OK(J.OpenInstance("Wheel", id_of_wheel, Dtk_transfo(X, Y, Z, Dtk_pnt(0, 0, 5)))); // open instance
362  Dtk_BodyPtr wheel = sampleWriter::CreateCyl(1, 1);
363  CHECK_OK(J.AddBody(wheel));
364  CHECK_OK(J.CloseLastInstance()); // close Wheel
365 
366  CHECK_OK(J.OpenInstance("Wheel2", id_of_wheel, Dtk_transfo(X, -Y, -Z, Dtk_pnt()))); // open reinstance
367  CHECK_OK(J.CloseLastInstance()); // reinstancied : must close Wheel immediatly.
368 
369  CHECK_OK(J.CloseLastInstance()); // close Wheels
370 
371  CHECK_OK(J.CloseLastInstance()); // close RootNode
372  cout << "=> " << outputFileName.c_str() << endl;
373  return dtkNoError;// Automatic Finish while J released
374 }

◆ JtwSamplePMI_Geom_association_5_4()

Dtk_ErrorStatus JtwSamplePMI_Geom_association_5_4 ( const Dtk_string outputFileName)
804 {
805  Dtk_ErrorStatus err;
806  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
807  CHECK_OK(err);
808  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
809 
810  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
811  CHECK_OK(J.AddBody(cylinder)); // Add the body
812 
813  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
814  CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
815 
816  Dtk_pnt from(300, 300, 300);
817  Dtk_pnt to(0, 0, 0);
818  Dtk_dir up(-0.57735, 0.57735, -0.57735);
819  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
820  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
821  mv2->info() = Dtk_Info::create();
822  mv2->info()->SetName("SecondView");
823  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
824 
825  CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
826 
827  CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE)); // Connect PMI 5 on body, on face ID= 2
828  CHECK_OK(J.ConnectPMI_Geom(5, 15, DTK_TYPE_EDGE)); // Connect PMI 5 on body, on edge ID= 15
829 
830  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
831  cout << "=> " << outputFileName.c_str() << endl;
832  return dtkNoError;// Automatic Finish while J released
833 }

◆ JtwSamplePMI_Geom_one_association_5_8()

Dtk_ErrorStatus JtwSamplePMI_Geom_one_association_5_8 ( const Dtk_string outputFileName)
1031 {
1032  Dtk_ErrorStatus err;
1033  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
1034  CHECK_OK(err);
1035  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
1036 
1037  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
1038  cylinder->info()->SetId(10);
1039  CHECK_OK(J.AddBody(cylinder)); // Add the body
1040 
1041  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
1042  Shift(cylinder2, 250);
1043  cylinder2->info()->SetId(11);
1044  CHECK_OK(J.AddBody(cylinder2)); // Add the body
1045 
1046  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
1047  CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
1048 
1049  Dtk_pnt from(300, 300, 300);
1050  Dtk_pnt to(0, 0, 0);
1051  Dtk_dir up(-0.57735, 0.57735, -0.57735);
1052  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
1053  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
1054  mv2->info() = Dtk_Info::create();
1055  mv2->info()->SetName("SecondView");
1056  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
1057 
1058  CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
1059 
1060  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
1061  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
1062 
1063  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
1064  cout << "=> " << outputFileName.c_str() << endl;
1065  return dtkNoError;// Automatic Finish while J released
1066 }

◆ JtwSamplePMI_MV_association_5_3()

Dtk_ErrorStatus JtwSamplePMI_MV_association_5_3 ( const Dtk_string outputFileName)
773 {
774  Dtk_ErrorStatus err;
775  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
776  CHECK_OK(err);
777  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
778 
779  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
780  CHECK_OK(J.AddBody(cylinder)); // Add the body
781 
782  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
783  CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
784 
785  Dtk_pnt from(300, 300, 300);
786  Dtk_pnt to(0, 0, 0);
787  Dtk_dir up(-0.57735, 0.57735, -0.57735);
788  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 250, 250, up);
789  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
790  mv2->info() = Dtk_Info::create();
791  mv2->info()->SetName("SecondView");
792  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
793 
794  CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // Connect PMI 5 into Modelview 8
795 
796  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
797  cout << "=> " << outputFileName.c_str() << endl;
798  return dtkNoError;// Automatic Finish while J released
799 }

◆ JtwSamplePMI_PMI_association_5_6()

Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6 ( const Dtk_string outputFileName)
895 {
896  Dtk_ErrorStatus err;
897  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
898  CHECK_OK(err);
899  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
900 
901  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
902  CHECK_OK(J.AddBody(cylinder)); // Add the body
903 
904  int i;
905  for (i = 0; i < 10; i++) // create 10 PMI
906  {
907  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
908  Shift(pmi, 15 * i);
909  CHECK_OK(J.AddPMI(pmi, 5 + i)); // Add the PMI, set ID = 5
910  }
911  Dtk_pnt from(300, 300, 300);
912  Dtk_pnt to(0, 0, 0);
913  Dtk_dir up(-0.57735, 0.57735, -0.57735);
914  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
915  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
916  mv2->info() = Dtk_Info::create();
917  mv2->info()->SetName("SecondView");
918  CHECK_OK(J.AddModelView(mv2, 30)); // Add Modelview, set ID = 8
919 
920  for (i = 0; i < 10; i++) // link the 10 PMIto ModelView
921  {
922  CHECK_OK(J.ConnectPMI_ModelView(5 + i, 30));
923  }
924 
925  CHECK_OK(J.ConnectPMI_PMI(6, 8)); // Associate PMI 6 to PMI 8
926 
927  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
928  cout << "=> " << outputFileName.c_str() << endl;
929  return dtkNoError;// Automatic Finish while J released
930 }

◆ JtwSampleSimpleModelview_5_2()

Dtk_ErrorStatus JtwSampleSimpleModelview_5_2 ( const Dtk_string outputFileName)
736 {
737  Dtk_ErrorStatus err;
738  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
739  CHECK_OK(err);
740  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
741 
742  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
743  CHECK_OK(J.AddBody(cylinder)); // Add the body
744 
745  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
746  CHECK_OK(J.AddPMI(pmi)); // Add the PMI
747 
748  Dtk_pnt from(0, 0, 100);
749  Dtk_pnt to(0, 0, 0);
750  Dtk_dir up(0, 1, 0);
751  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 100, 100, up); // semiwidth = 100
752  Dtk_ModelDisplayPtr mvfit = Dtk_ModelDisplay::Create(cam, NULL, 1);
753  mvfit->info() = Dtk_Info::create();
754  mvfit->info()->SetName("FitView");
755  CHECK_OK(J.AddModelView(mvfit));
756 
757  from = Dtk_pnt(300, 300, 300);
758  up = Dtk_dir(-0.57735, 0.57735, -0.57735);
759  cam = Dtk_Camera::Create(from, to, 250, 250, up);
760  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
761  mv2->info() = Dtk_Info::create();
762  mv2->info()->SetName("SecondView");
763  CHECK_OK(J.AddModelView(mv2));
764 
765  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
766  cout << "=> " << outputFileName.c_str() << endl;
767  return dtkNoError;// Automatic Finish while J released
768 }

◆ JtwSampleSimplePMI_5_1()

Dtk_ErrorStatus JtwSampleSimplePMI_5_1 ( const Dtk_string outputFileName)
716 {
717  Dtk_ErrorStatus err;
718  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
719  CHECK_OK(err);
720  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
721 
722  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=1, height=2 (with a green face)
723  CHECK_OK(J.AddBody(cylinder)); // Add the body
724 
725  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
726  CHECK_OK(J.AddPMI(pmi)); // Add the PMI
727 
728  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
729  cout << "=> " << outputFileName.c_str() << endl;
730  return dtkNoError;// Automatic Finish while J released
731 }

◆ JtwSampleTextures_1_3()

Dtk_ErrorStatus JtwSampleTextures_1_3 ( const Dtk_string outputFileName)
131 {
132  Dtk_ErrorStatus err;
133  Dtk_Jtw_Interface J( outputFileName, err );
134  CHECK_OK( err );
135  CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
136  Dtk_MeshPtr TextureMesh = CreateTextureMesh(); // create a simple red cube
137  CHECK_OK( J.AddMesh( TextureMesh ) ); // write the cube
138  CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
139  cout << "=> " << outputFileName.c_str() << endl;
140  return dtkNoError; // Automatic Finish while J released
141 }

◆ JtwSampleUnits_4_2()

Dtk_ErrorStatus JtwSampleUnits_4_2 ( const Dtk_string outputFileName)
608 {
609  Dtk_ErrorStatus err;
611  // set units as inches
612  CHECK_OK(err);
613  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
614  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
615  CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
616  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
617  cout << "=> " << outputFileName.c_str() << endl;
618  return dtkNoError;// Automatic Finish while J released
619 }

◆ JtwSampleVersion_4_1()

Dtk_ErrorStatus JtwSampleVersion_4_1 ( const Dtk_string outputFileName)
593 {
594  Dtk_ErrorStatus err;
595  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep, Dtk_Jtw_Interface::version80); // set version 8.0
596  CHECK_OK(err);
597  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
598  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
599  CHECK_OK(J.AddMesh(CubeMesh)); // write the cube
600  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
601  cout << "=> " << outputFileName.c_str() << endl;
602  return dtkNoError;// Automatic Finish while J released
603 }

◆ JtwSampleWireBody_2_3()

Dtk_ErrorStatus JtwSampleWireBody_2_3 ( const Dtk_string outputFileName)
188 {
189  Dtk_ErrorStatus err;
190  Dtk_Jtw_Interface J(outputFileName, err, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
191  CHECK_OK(err);
192  CHECK_OK(J.OpenInstance("RootNode")); // Rootnode creation
193 
195  CHECK_OK(J.AddBody(wire));
196 
198  CHECK_OK(J.AddBody(wire2));
199 
200  CHECK_OK(J.CloseLastInstance()); // Rootnode closing.
201  cout << "=> " << outputFileName.c_str() << endl;
202  return dtkNoError;// Automatic Finish while J released
203 }

◆ MakeMultiSection()

Dtk_EntityPtr MakeMultiSection ( )
838 {
839  Dtk_BodyPtr body = Dtk_Body::Create();
840  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
841  body->AddOpenShell(shell);
842  Dtk_FacePtr face1 = Dtk_Face::Create(body);
843  Dtk_PlaneSurfacePtr section1 = Dtk_PlaneSurface::Create(Dtk_pnt(), Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0));
844  section1->info() = Dtk_Info::create();
845  section1->info()->SetColor(Dtk_RGB(128, 0, 0)); // red
846  face1->SetGeom(Dtk_SurfacePtr::DtkDynamicCast(section1));
847  shell->AddFace(face1, DTK_TRUE);
848  Dtk_FacePtr face2 = Dtk_Face::Create(body);
849  Dtk_PlaneSurfacePtr section2 = Dtk_PlaneSurface::Create(Dtk_pnt(), Dtk_dir(0, 1, 0), Dtk_dir(1, 0, 0));
850  section2->info() = Dtk_Info::create();
851  section2->info()->SetColor(Dtk_RGB(0, 0, 128)); // blue
852  face2->SetGeom(Dtk_SurfacePtr::DtkDynamicCast(section2));
853  shell->AddFace(face2, DTK_TRUE);
854  return Dtk_EntityPtr::DtkDynamicCast(body);
855 }

◆ MakePmiOnRoot()

Dtk_ErrorStatus MakePmiOnRoot ( Dtk_Jtw_Interface J,
int  option 
)
1148 {
1149  Dtk_pnt from(300, 300, 300);
1150  Dtk_pnt to(3, 0, 3);
1151  Dtk_dir up(-0.57735, 0.57735, -0.57735);
1152  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 5, 5, up);
1153  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
1154  mv2->info() = Dtk_Info::create();
1155  mv2->info()->SetName("View");
1156  CHECK_OK(J.AddModelView(mv2, 8)); // Add Modelview, set ID = 8
1157 
1158  if (option == 1) // 6.2. Add instances by addition
1159  {
1160  Dtk_Int64 r1[] = { 1,11,2,13,4,14 }; // target one specific wheel
1161  Dtk_Int64 r2[] = { 1,16 }; // target one specific axle subassembly
1164  }
1165  if (option == 2) // 6.3. Remove instances (soustraction)
1166  {
1167  Dtk_Int64 r1[] = { 1,11,2,13,4,14 }; // target one specific wheel
1168  CHECK_OK(J.ConnectModelView_Instance(8, Makeroute(r1, 6), 1)); // last parameter hide = 1
1169  }
1170  if (option == 3) // 6.4. Target PMI on assembly geometry
1171  {
1172  Dtk_FdtPtr pmi = CreateFdtDatumAt(Dtk_pnt(0, 1, 0));
1173  CHECK_OK(J.AddPMI(pmi, 5)); // Add the PMI, set ID = 5
1174  CHECK_OK(J.ConnectPMI_ModelView(5, 8)); // set PMI into Modelview
1175  Dtk_Int64 r1[] = { 1,11,2,13,4,15,5 }; // target one specific wheel
1176  CHECK_OK(J.ConnectPMI_Geom(5, 3, DTK_TYPE_FACE, Makeroute(r1, 7)));
1177  Dtk_Int64 r2[] = { 1,16,2,12, 3 }; // target one specific axle
1178  CHECK_OK(J.ConnectPMI_Geom(5, 2, DTK_TYPE_FACE, Makeroute(r2, 5)));
1179  }
1180  if( option == 4 ) // 6.2. Add instances by addition, and shift for exploded view
1181  {
1182  Dtk_Int64 rsub[] = { 1,16 }; // target one specific axle subassembly
1183  Dtk_Int64 rw1[] = { 1,11,2,13,4,14 }; // target the first wheel of the other axle subassembly
1184  Dtk_Int64 rw2[] = { 1,11,2,13,4,15 }; // target the second wheel of the other axle subassembly
1185  Dtk_Int64 ra[] = { 1,11,2,12 }; // target the axle of the other axle subassembly
1186  Dtk_dir X( 1, 0, 0 );
1187  Dtk_dir Y( 0, 1, 0 );
1188  Dtk_dir Z( 0, 0, 1 );
1189  Dtk_transfo newplacementwheel1( X, Y, Z, Dtk_pnt( 0, 0, 8 ) );
1190  Dtk_transfo newplacementwheel2( X, -Y, -Z, Dtk_pnt( 0, 0, -3 ) );
1191  CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( rsub, 2 ) ) );
1192  CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( ra, 4 ) ) );
1193  CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( rw1, 6 ), 0, 0, &newplacementwheel1 ) );
1194  CHECK_OK( J.ConnectModelView_Instance( 8, Makeroute( rw2, 6 ), 0, 0, &newplacementwheel2 ) );
1195  }
1196  return dtkNoError;
1197 }

◆ MakeReferenceAxis()

Dtk_BodyPtr MakeReferenceAxis ( )
954 {
955  Dtk_BodyPtr body = Dtk_Body::Create();
956  body->info() = Dtk_Info::create();
957  body->info()->SetName("MyReferenceAxis");
958  body->info()->SetInfiniteGeometryFlag(1); // mandatory
959  body->info()->SetColor(Dtk_RGB(0, 128, 0)); // color green
960  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
961  body->AddOpenShell(shell);
962  Dtk_tab<Dtk_CurvePtr> tabwire;
963  Dtk_LinePtr L = Dtk_Line::Create(Dtk_pnt(100, 100, 0), Dtk_dir(0, 0, 1));
964  L->SetTrimmingParameters(0.0, 200.0);
966  shell->AddWire(tabwire);
967  return body;
968 }

◆ MakeReferencePlane()

Dtk_BodyPtr MakeReferencePlane ( )
936 {
937  Dtk_BodyPtr body = Dtk_Body::Create();
938  body->info() = Dtk_Info::create();
939  body->info()->SetName("MyReferencePlane");
940  body->info()->SetInfiniteGeometryFlag(1); // mandatory
941  body->info()->SetColor(Dtk_RGB(128, 0, 0)); // color red
942  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
943  body->AddOpenShell(shell);
944  Dtk_FacePtr face1 = Dtk_Face::Create(body);
945  Dtk_PlaneSurfacePtr plane = Dtk_PlaneSurface::Create(Dtk_pnt(), Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0));
946  double box[4] = { -200,200,-200,200 }; // trim of the plane
947  plane->SetTrimUVBox(box);
949  shell->AddFace(face1, DTK_TRUE);
950  return body;
951 }

◆ MakeReferencePoint()

Dtk_BodyPtr MakeReferencePoint ( )
971 {
972  Dtk_BodyPtr body = Dtk_Body::Create();
973  body->info() = Dtk_Info::create();
974  body->info()->SetName("MyReferencePoint");
975  body->info()->SetInfiniteGeometryFlag(1); // mandatory
976  body->info()->SetColor(Dtk_RGB(0, 0, 128)); // color blue
977  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
978  body->AddOpenShell(shell);
979  Dtk_tab<Dtk_PointPtr> tabpoints;
980  Dtk_PointPtr point = Dtk_Point::Create(Dtk_pnt(120, 120, 0));
981  tabpoints.push_back(point);
982  shell->AddWire(tabpoints);
983  return body;
984 }

◆ Makeroute()

Dtk_tab<Dtk_Int64> Makeroute ( Dtk_Int64  r[],
int  nb 
)
1128 {
1129  Dtk_tab<Dtk_Int64> res;
1130  for (int i = 0; i < nb; i++)
1131  res.push_back(r[i]);
1132  return res;
1133 }

◆ SampleLossyCompression_2_6()

Dtk_ErrorStatus SampleLossyCompression_2_6 ( const Dtk_string outputFileName)
284 {
285  Dtk_ErrorStatus err;
286  Dtk_Jtw_Interface J( outputFileName, err, Dtk_Jtw_Interface::xtbrep ); // Specify allowing BREP Writing
287  CHECK_OK( err );
288  CHECK_OK( J.OpenInstance( "RootNode" ) ); // Rootnode creation
289 
290  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 1, 2 ); // Create a Cylinder radius=1, height=2 (with a green face)
291  CHECK_OK( J.AddBody( cylinder ) ); // Add the body, tessellated as default tess_InitTesselation value
292 
293  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl( 1, 2 ); // Create another Cylinder radius=1, height=2 (with a green face)
294  Shift( cylinder2, 3 ); // shift the cylinder, see exemple above
295  Dtk_tab<Dtk_Float32> lods; // create a LOD array
296  lods.push_back( 0.001f ); lods.push_back( -1 ); // Highest LOD : linear tol = 0.001, angular automatic
297  lods.push_back( 0.01f ); lods.push_back( -1 ); // Medium LOD : linear tol = 0.01, angular automatic
298  lods.push_back( 0.1f ); lods.push_back( -1 ); // Lower LOD : linear tol = 0.1, angular automatic
299  CHECK_OK( J.AddBody( cylinder2, lods , 0.01f ) ); // add the body, will tessellate automaticly for LODS, and a Lossy factor of 0.01
300 
301  CHECK_OK( J.CloseLastInstance() ); // Rootnode closing.
302  cout << "=> " << outputFileName.c_str() << endl;
303  return dtkNoError;// Automatic Finish while J released
304 }

◆ SetLightMapOnOneFace()

void SetLightMapOnOneFace ( Dtk_BodyPtr body,
const Dtk_RGB ambiant,
const Dtk_RGB diffuse,
const Dtk_RGB specular,
float  shininess 
)
237 {
238  size_t i, nb = body->GetNumTopologicalEntities( DTK_TYPE_UNKNOWN );
239  for( i = 0; i < nb; i++ )
240  {// fetch first face, then abort
241  Dtk_TopologicalEntityPtr topo = body->GetPtr( (Dtk_ID)i );
242  if( topo.IsNULL() || topo->get_type_detk() != DTK_TYPE_FACE )
243  continue;
245  Dtk_LightMapPtr lightmap = Dtk_LightMap::Create( ambiant, diffuse, specular );
246  lightmap->SetShininessRatio( shininess );
247  Dtk_RenderInfosPtr render = Dtk_RenderInfos::Create( "uselessname", lightmap, NULL );
248  face->info()->AddRenderInfos( render );
249  break;
250  }
251 }

◆ Shift()

template<typename T >
void Shift ( T &  mesh,
double  sh 
)
43 {
44  Dtk_transfo t;
45  t.addTranslate(Dtk_dir(sh, 0, 0));
46  mesh->Transform(t);
47 }
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.
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_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.
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:204
DTK_PICTURE_RGB24
@ DTK_PICTURE_RGB24
Definition: dtk_picture.hpp:28
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
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_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_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_Entity >::DtkDynamicCast
static Dtk_SmartPtr< Dtk_Entity > 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.
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
CreateTextureMesh
Dtk_MeshPtr CreateTextureMesh()
Definition: testlibjtwrite.cpp:99
SampleLossyCompression_2_6
Dtk_ErrorStatus SampleLossyCompression_2_6(const Dtk_string &outputFileName)
Definition: testlibjtwrite.cpp:283
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
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_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.
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
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
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
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Definition: testcreatecube.cpp:1357
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Definition: testcreatecube.cpp:1434
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
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_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
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()