DATAKIT SDK  V2026.4
testlibjtwrite.cpp File Reference

Functions

void AddVertex (Dtk_MeshPtr inoutMesh, const Dtk_pnt &inPosition, const Dtk_dir &inNormal, float inTexU, float inTexV)
 
DtkErrorStatus AllJtWTests (const Dtk_string &inResultDirectory)
 
Dtk_FdtPtr CreateFdtDatumAt (const Dtk_pnt &inPosition)
 
Dtk_LayerInfosSetPtr CreateLayerInfosSet ()
 
Dtk_ModelDisplayPtr CreateModelDisplay (const Dtk_string &inName)
 
Dtk_MeshPtr CreateTextureMesh ()
 
DtkErrorStatus JtWriteSample (const Dtk_string &inResultDirectory)
 
Dtk_ErrorStatus JtwSampleAsmInstances_3_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleAssembly_3_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleAxis_References_5_7 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleBody_2_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleBodyLOD_2_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleBodyVisibility_2_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleInstancesColors_3_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleInstancesVisibily_3_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleLayerNames_4_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleLayers_4_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleLightmap_2_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleMeshes_1_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleMetadatas_4_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleModelview_sections_5_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleModelViewAsm_6_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleModelViewTarget_6_2 (const Dtk_string &inOutputFileName, int inOption)
 
Dtk_ErrorStatus JtwSampleMultipleFilesPerPart_3_6 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleMultipleFilesShattered_3_7 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleOneMesh_1_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSamplePartInstances_3_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_Geom_association_5_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_Geom_one_association_5_8 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_MV_association_5_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleSimpleModelview_5_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleSimplePMI_5_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleTextures_1_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleUnits_4_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleVersion_4_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus JtwSampleWireBody_2_3 (const Dtk_string &inOutputFileName)
 
Dtk_EntityPtr MakeMultiSection ()
 
Dtk_ErrorStatus MakePmiOnRoot (Dtk_Jtw_Interface &inoutJtWriter, int inOption)
 
Dtk_BodyPtr MakeReferenceAxis ()
 
Dtk_BodyPtr MakeReferencePlane ()
 
Dtk_BodyPtr MakeReferencePoint ()
 
Dtk_tab< Dtk_Int64 > Makeroute (Dtk_Int64 inRouteIds[], int inCount)
 
Dtk_ErrorStatus SampleLossyCompression_2_6 (const Dtk_string &inOutputFileName)
 
void SetLightMapOnOneFace (Dtk_BodyPtr &inoutBody, const Dtk_RGB &inAmbient, const Dtk_RGB &inDiffuse, const Dtk_RGB &inSpecular, float inShininess)
 
template<typename T >
void Shift (T &inoutMesh, double inShiftAmount)
 

Function Documentation

◆ AddVertex()

void AddVertex ( Dtk_MeshPtr  inoutMesh,
const Dtk_pnt &  inPosition,
const Dtk_dir &  inNormal,
float  inTexU,
float  inTexV 
)
92 {
93  inoutMesh->add_vertex( &inPosition, &inNormal, NULL, inTexU, inTexV );
94 }

◆ AllJtWTests()

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

◆ CreateFdtDatumAt()

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

◆ CreateLayerInfosSet()

Dtk_LayerInfosSetPtr CreateLayerInfosSet ( )
672 {
674  lay->AddLayer( Dtk_LayerInfosSet::Layer( 3, L"LayerThree" ) ); // first layer has ID 3
675  lay->AddLayer( Dtk_LayerInfosSet::Layer( 5, L"LayerFive" ) ); // second layer has ID 5
676  return lay;
677 }

◆ CreateModelDisplay()

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

◆ CreateTextureMesh()

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

◆ JtWriteSample()

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

◆ JtwSampleAsmInstances_3_3()

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

◆ JtwSampleAssembly_3_1()

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

◆ JtwSampleAxis_References_5_7()

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

◆ JtwSampleBody_2_1()

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

◆ JtwSampleBodyLOD_2_2()

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

◆ JtwSampleBodyVisibility_2_4()

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

◆ JtwSampleInstancesColors_3_4()

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

◆ JtwSampleInstancesVisibily_3_5()

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

◆ JtwSampleLayerNames_4_5()

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

◆ JtwSampleLayers_4_4()

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

◆ JtwSampleLightmap_2_5()

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

◆ JtwSampleMeshes_1_2()

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

◆ JtwSampleMetadatas_4_3()

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

◆ JtwSampleModelview_sections_5_5()

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

◆ JtwSampleModelViewAsm_6_1()

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

◆ JtwSampleModelViewTarget_6_2()

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

◆ JtwSampleMultipleFilesPerPart_3_6()

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

◆ JtwSampleMultipleFilesShattered_3_7()

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

◆ JtwSampleOneMesh_1_1()

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

◆ JtwSamplePartInstances_3_2()

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

◆ JtwSamplePMI_Geom_association_5_4()

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

◆ JtwSamplePMI_Geom_one_association_5_8()

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

◆ JtwSamplePMI_MV_association_5_3()

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

◆ JtwSamplePMI_PMI_association_5_6()

Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6 ( const Dtk_string &  inOutputFileName)
890 {
891  Dtk_ErrorStatus errorStatus;
892  Dtk_Jtw_Interface jtWriter(inOutputFileName, errorStatus, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
893  CHECK_OK(errorStatus);
894  CHECK_OK(jtWriter.OpenInstance("RootNode")); // Rootnode creation
895 
896  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl(100, 150); // Create a Cylinder radius=100, height=150 (with a green face)
897  CHECK_OK(jtWriter.AddBody(cylinder)); // Add the body
898 
899  int pmiIdx;
900  for (pmiIdx = 0; pmiIdx < 10; pmiIdx++) // create 10 PMI
901  {
902  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
903  if( pmi.IsNotNULL() && pmi->Sub2DEntity().IsNotNULL() && pmi->Sub2DEntity()->get_type_detk() == DTK_TYPE_SYMBOL)
904  { // changing letter inside PMI (datum feature symbol), or JT2Go recognize as same PMI with semantic informations, and example fails.
905  Dtk_SymbolPtr symb = Dtk_SymbolPtr::DtkDynamicCast( pmi->Sub2DEntity() );
906  if (symb.IsNotNULL() && symb->Texts().GetNumTexts() > 0 && symb->Texts()[0].Text().len()>0)
907  symb->Texts()[ 0 ].Text()[ 0 ] = (wchar_t)('A' + pmiIdx);
908  }
909  Shift(pmi, 15 * pmiIdx);
910  CHECK_OK(jtWriter.AddPMI(pmi, 5 + pmiIdx)); // Add the PMI, set ID = 5
911  }
912  Dtk_pnt from(300, 300, 300);
913  Dtk_pnt to(0, 0, 0);
914  Dtk_dir up(-0.57735, 0.57735, -0.57735);
915  Dtk_CameraPtr cam = Dtk_Camera::Create(from, to, 150, 150, up);
916  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create(cam, NULL, 1);
917  mv2->info() = Dtk_Info::Create();
918  mv2->info()->SetName("SecondView");
919  CHECK_OK(jtWriter.AddModelView(mv2, 30)); // Add Modelview, set ID = 8
920 
921  for (pmiIdx = 0; pmiIdx < 10; pmiIdx++) // link the 10 PMIto ModelView
922  {
923  CHECK_OK(jtWriter.ConnectPMI_ModelView(5 + pmiIdx, 30));
924  }
925 
926  CHECK_OK(jtWriter.ConnectPMI_PMI(6, 8)); // Associate PMI 6 to PMI 8
927 
928  CHECK_OK(jtWriter.CloseLastInstance()); // Rootnode closing.
929  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
930  return dtkNoError;// Automatic Finish while J released
931 }

◆ JtwSampleSimpleModelview_5_2()

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

◆ JtwSampleSimplePMI_5_1()

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

◆ JtwSampleTextures_1_3()

Dtk_ErrorStatus JtwSampleTextures_1_3 ( const Dtk_string &  inOutputFileName)
128 {
129  Dtk_ErrorStatus errorStatus;
130  Dtk_Jtw_Interface jtWriter( inOutputFileName, errorStatus );
131  CHECK_OK( errorStatus );
132  CHECK_OK( jtWriter.OpenInstance( "RootNode" ) ); // Rootnode creation
133  Dtk_MeshPtr TextureMesh = CreateTextureMesh(); // create a simple red cube
134  CHECK_OK( jtWriter.AddMesh( TextureMesh ) ); // write the cube
135  CHECK_OK( jtWriter.CloseLastInstance() ); // Rootnode closing.
136  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
137  return dtkNoError; // Automatic Finish while J released
138 }

◆ JtwSampleUnits_4_2()

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

◆ JtwSampleVersion_4_1()

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

◆ JtwSampleWireBody_2_3()

Dtk_ErrorStatus JtwSampleWireBody_2_3 ( const Dtk_string &  inOutputFileName)
185 {
186  Dtk_ErrorStatus errorStatus;
187  Dtk_Jtw_Interface jtWriter(inOutputFileName, errorStatus, Dtk_Jtw_Interface::xtbrep); // Specify allowing BREP Writing
188  CHECK_OK(errorStatus);
189  CHECK_OK(jtWriter.OpenInstance("RootNode")); // Rootnode creation
190 
192  CHECK_OK(jtWriter.AddBody(wire));
193 
195  CHECK_OK(jtWriter.AddBody(wire2));
196 
197  CHECK_OK(jtWriter.CloseLastInstance()); // Rootnode closing.
198  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
199  return dtkNoError;// Automatic Finish while J released
200 }

◆ MakeMultiSection()

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

◆ MakePmiOnRoot()

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

◆ MakeReferenceAxis()

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

◆ MakeReferencePlane()

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

◆ MakeReferencePoint()

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

◆ Makeroute()

Dtk_tab<Dtk_Int64> Makeroute ( Dtk_Int64  inRouteIds[],
int  inCount 
)
1129 {
1130  Dtk_tab<Dtk_Int64> res;
1131  for (int routeIdx = 0; routeIdx < inCount; routeIdx++)
1132  res.push_back(inRouteIds[routeIdx]);
1133  return res;
1134 }

◆ SampleLossyCompression_2_6()

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

◆ SetLightMapOnOneFace()

void SetLightMapOnOneFace ( Dtk_BodyPtr &  inoutBody,
const Dtk_RGB &  inAmbient,
const Dtk_RGB &  inDiffuse,
const Dtk_RGB &  inSpecular,
float  inShininess 
)
234 {
235  size_t idx, nb = inoutBody->GetNumTopologicalEntities( DTK_TYPE_UNKNOWN );
236  for( idx = 0; idx < nb; idx++ )
237  {// fetch first face, then abort
238  Dtk_TopologicalEntityPtr topo = inoutBody->GetPtr( (Dtk_ID)idx );
239  if( topo.IsNULL() || topo->get_type_detk() != DTK_TYPE_FACE )
240  continue;
242  Dtk_LightMapPtr lightmap = Dtk_LightMap::Create( inAmbient, inDiffuse, inSpecular );
243  lightmap->SetShininessRatio( inShininess );
244  Dtk_RenderInfosPtr render = Dtk_RenderInfos::Create( "uselessname", lightmap, NULL );
245  face->info()->AddRenderInfos( render );
246  break;
247  }
248 }

◆ Shift()

template<typename T >
void Shift ( T &  inoutMesh,
double  inShiftAmount 
)
40 {
41  Dtk_transfo translation;
42  translation.addTranslate(Dtk_dir(inShiftAmount, 0, 0));
43  inoutMesh->Transform(translation);
44 }
Dtk_Info::Create
static Dtk_SmartPtr< Dtk_Info > Create()
Calls default constructor to allocate a new object.
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.
DTK_MESH_NORMAL
#define DTK_MESH_NORMAL
Definition: util_mesh_dtk.hpp:31
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:688
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:1076
DTK_TYPE_UNKNOWN
@ DTK_TYPE_UNKNOWN
Definition: define.h:26
CreateFdtDatumAt
Dtk_FdtPtr CreateFdtDatumAt(const Dtk_pnt &inPosition)
Definition: testlibjtwrite.cpp:1136
Dtk_TextureInfos::Create
static Dtk_TextureInfosPtr Create(const TextureMappingTypeEnum &inType)
Create a Dtk_TextureInfosPtr.
JtwSampleMetadatas_4_3
Dtk_ErrorStatus JtwSampleMetadatas_4_3(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:621
JtwSampleSimpleModelview_5_2
Dtk_ErrorStatus JtwSampleSimpleModelview_5_2(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:730
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.
JtwSamplePMI_Geom_association_5_4
Dtk_ErrorStatus JtwSamplePMI_Geom_association_5_4(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:798
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:207
DTK_PICTURE_RGB24
@ DTK_PICTURE_RGB24
Definition: dtk_picture.hpp:22
JtwSampleMultipleFilesShattered_3_7
Dtk_ErrorStatus JtwSampleMultipleFilesShattered_3_7(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:545
Dtk_SmartPtr::IsNotNULL
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
Dtk_picture::PixelWidth
Dtk_Size_t & PixelWidth()
Retrieves the width (in pixels)
Definition: dtk_picture.hpp:85
sampleWriter::CreateCyl
Dtk_BodyPtr CreateCyl(double radius, double height)
Creates a BRep cylinder body with the given radius and height using analytical cylindrical and planar...
Definition: testcreatecube.cpp:1770
AllJtWTests
DtkErrorStatus AllJtWTests(const Dtk_string &inResultDirectory)
Definition: testlibjtwrite.cpp:1241
sampleWriter::CreateMeshCubeVertexColor
Dtk_MeshPtr CreateMeshCubeVertexColor()
Creates a unit cube mesh with per-vertex color data (red, green, blue, white cycling per face).
Definition: testcreatemesh.cpp:300
JtwSampleLayers_4_4
Dtk_ErrorStatus JtwSampleLayers_4_4(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:643
Dtk_LayerInfosSet::Layer
Definition: util_ent_dtk.hpp:512
CreateLayerInfosSet
Dtk_LayerInfosSetPtr CreateLayerInfosSet()
Definition: testlibjtwrite.cpp:671
sampleWriter::CreateMeshPoints
Dtk_MeshPtr CreateMeshPoints()
Points mesh sample.
Definition: testcreatemesh.cpp:440
tess_InitTesselation
int tess_InitTesselation(Dtk_string inWorkingDirectory, double inTolerance)
Init the tesselation library.
DTK_TRUE
#define DTK_TRUE
Definition: define.h:726
Dtk_mesh::Create
static Dtk_MeshPtr Create(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
Constructor.
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
JtwSampleModelViewAsm_6_1
Dtk_ErrorStatus JtwSampleModelViewAsm_6_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:1083
JtwSamplePartInstances_3_2
Dtk_ErrorStatus JtwSamplePartInstances_3_2(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:341
Dtk_RenderInfos::Create
static Dtk_RenderInfosPtr Create(const Dtk_string &inName)
Creates a Dtk_RenderInfosPtr.
JtwSampleVersion_4_1
Dtk_ErrorStatus JtwSampleVersion_4_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:589
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.
MakePmiOnRoot
Dtk_ErrorStatus MakePmiOnRoot(Dtk_Jtw_Interface &inoutJtWriter, int inOption)
Definition: testlibjtwrite.cpp:1148
DTK_TYPE_SYMBOL
@ DTK_TYPE_SYMBOL
Definition: define.h:400
Dtk_picture::MetricWidth
double & MetricWidth()
Retrieves the width (in mm)
Definition: dtk_picture.hpp:95
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
JtwSampleInstancesColors_3_4
Dtk_ErrorStatus JtwSampleInstancesColors_3_4(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:418
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:90
JtwSampleAssembly_3_1
Dtk_ErrorStatus JtwSampleAssembly_3_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:307
MakeReferenceAxis
Dtk_BodyPtr MakeReferenceAxis()
Definition: testlibjtwrite.cpp:954
JtwSampleMultipleFilesPerPart_3_6
Dtk_ErrorStatus JtwSampleMultipleFilesPerPart_3_6(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:502
Dtk_picture::FileType
Dtk_PictureType & FileType()
Retrieves the file type.
Definition: dtk_picture.hpp:81
Dtk_Face::Create
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
CreateModelDisplay
Dtk_ModelDisplayPtr CreateModelDisplay(const Dtk_string &inName)
Definition: testlibjtwrite.cpp:1071
JtwSamplePMI_Geom_one_association_5_8
Dtk_ErrorStatus JtwSamplePMI_Geom_one_association_5_8(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:1031
JtwSampleTextures_1_3
Dtk_ErrorStatus JtwSampleTextures_1_3(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:127
Dtk_Jtw_Interface::version95
@ version95
Definition: jtw.h:41
JtwSampleWireBody_2_3
Dtk_ErrorStatus JtwSampleWireBody_2_3(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:184
sampleWriter::CreateMeshWire
Dtk_MeshPtr CreateMeshWire()
Wire mesh sample.
Definition: testcreatemesh.cpp:389
Dtk_picture::MetricHeight
double & MetricHeight()
Retrieves the height (in mm)
Definition: dtk_picture.hpp:99
JtwSampleOneMesh_1_1
Dtk_ErrorStatus JtwSampleOneMesh_1_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:21
Dtk_picture::File
Dtk_tab< char > & File()
Retrieves the binary file.
Definition: dtk_picture.hpp:77
Dtk_picture
This class defines a picture.
Definition: dtk_picture.hpp:39
Makeroute
Dtk_tab< Dtk_Int64 > Makeroute(Dtk_Int64 inRouteIds[], int inCount)
Definition: testlibjtwrite.cpp:1128
Dtk_Int64
int64_t Dtk_Int64
Definition: define.h:691
Dtk_AxisSystem::Create
static Dtk_SmartPtr< Dtk_AxisSystem > Create()
Calls default constructor to allocate a new object.
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Creates simple Datum.
Definition: testcreatefdt.cpp:14
Dtk_TextureInfos::StoredUVMapping
@ StoredUVMapping
Definition: dtk_render.hpp:35
JtwSampleModelview_sections_5_5
Dtk_ErrorStatus JtwSampleModelview_sections_5_5(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:852
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:132
JtwSamplePMI_PMI_association_5_6
Dtk_ErrorStatus JtwSamplePMI_PMI_association_5_6(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:889
Shift
void Shift(T &inoutMesh, double inShiftAmount)
Definition: testlibjtwrite.cpp:39
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:29
JtwSampleSimplePMI_5_1
Dtk_ErrorStatus JtwSampleSimplePMI_5_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:710
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.
CHECK_OK
#define CHECK_OK(X)
Definition: testwriters.h:8
JtwSampleMeshes_1_2
Dtk_ErrorStatus JtwSampleMeshes_1_2(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:46
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
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:96
Dtk_Point::Create
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
AddVertex
void AddVertex(Dtk_MeshPtr inoutMesh, const Dtk_pnt &inPosition, const Dtk_dir &inNormal, float inTexU, float inTexV)
Definition: testlibjtwrite.cpp:91
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
MakeReferencePlane
Dtk_BodyPtr MakeReferencePlane()
Definition: testlibjtwrite.cpp:936
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
JtwSampleLightmap_2_5
Dtk_ErrorStatus JtwSampleLightmap_2_5(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:250
Dtk_Jtw_Interface::AddModelView
Dtk_ErrorStatus AddModelView(const Dtk_ModelDisplayPtr &inModelview, Dtk_Int64 inIdmodelview=-1)
Add a modelView into the current node.
JtwSamplePMI_MV_association_5_3
Dtk_ErrorStatus JtwSamplePMI_MV_association_5_3(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:767
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Calls default constructor to allocate a new object.
JtwSampleAsmInstances_3_3
Dtk_ErrorStatus JtwSampleAsmInstances_3_3(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:375
JtwSampleBody_2_1
Dtk_ErrorStatus JtwSampleBody_2_1(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:143
Dtk_Line::Create
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
DTK_TYPE_EDGE
@ DTK_TYPE_EDGE
Definition: define.h:119
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
SetLightMapOnOneFace
void SetLightMapOnOneFace(Dtk_BodyPtr &inoutBody, const Dtk_RGB &inAmbient, const Dtk_RGB &inDiffuse, const Dtk_RGB &inSpecular, float inShininess)
Definition: testlibjtwrite.cpp:232
Dtk_LayerInfosSet::Create
static Dtk_LayerInfosSetPtr Create()
Calls default constructor to allocate a new object.
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:971
JtwSampleInstancesVisibily_3_5
Dtk_ErrorStatus JtwSampleInstancesVisibily_3_5(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:467
JtwSampleAxis_References_5_7
Dtk_ErrorStatus JtwSampleAxis_References_5_7(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:987
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct co...
Definition: testcreatecube.cpp:1368
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Creates a wireframe body demonstrating curve display styles: thick circle (4 mm), dashed blue circle,...
Definition: testcreatecube.cpp:1447
tess_EndTesselation
void tess_EndTesselation()
Free the data used by tesselation library.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:151
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
Dtk_RGB
Definition: dtk_rgb.hpp:8
SampleLossyCompression_2_6
Dtk_ErrorStatus SampleLossyCompression_2_6(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:280
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.
JtwSampleModelViewTarget_6_2
Dtk_ErrorStatus JtwSampleModelViewTarget_6_2(const Dtk_string &inOutputFileName, int inOption)
Definition: testlibjtwrite.cpp:1200
JtwSampleLayerNames_4_5
Dtk_ErrorStatus JtwSampleLayerNames_4_5(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:679
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.
JtwSampleUnits_4_2
Dtk_ErrorStatus JtwSampleUnits_4_2(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:604
Dtk_Jtw_Interface::overwritecolor
@ overwritecolor
Definition: jtw.h:31
JtwSampleBodyVisibility_2_4
Dtk_ErrorStatus JtwSampleBodyVisibility_2_4(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:205
Dtk_mesh_face::add_triangles
int add_triangles(Dtk_tab< Dtk_UInt32 > *inIndices)
Add one of multiple triangles.
JtwSampleBodyLOD_2_2
Dtk_ErrorStatus JtwSampleBodyLOD_2_2(const Dtk_string &inOutputFileName)
Definition: testlibjtwrite.cpp:158
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()