DATAKIT SDK  V2026.4
sampleWriter Namespace Reference

Namespaces

 layer
 

Enumerations

enum  {
  Lump = 1, Volume = 2, Shell = 3, Vertex_A = 9,
  Vertex_B = 11, Vertex_C = 17, Vertex_D = 23, Vertex_E = 37,
  Vertex_F = 45, Vertex_G = 63, Vertex_H = 81, Edge_AB = 14,
  Edge_CA = 20, Edge_DC = 26, Edge_BD = 30, Edge_EA = 40,
  Edge_FB = 48, Edge_FE = 52, Edge_GD = 66, Edge_GF = 70,
  Edge_HC = 84, Edge_HG = 88, Edge_EH = 96, Coedge0_AB = 8,
  Coedge1_AB = 42, Coedge0_CA = 16, Coedge5_CA = 112, Coedge0_DC = 22,
  Coedge3_DC = 78, Coedge0_BD = 28, Coedge2_BD = 60, Coedge1_EA = 36,
  Coedge5_EA = 114, Coedge1_FB = 44, Coedge2_FB = 58, Coedge1_FE = 50,
  Coedge2_GD = 62, Coedge3_GD = 76, Coedge4_FE = 98, Coedge2_GF = 68,
  Coedge4_GF = 100, Coedge3_HC = 80, Coedge5_HC = 110, Coedge3_HG = 86,
  Coedge4_HG = 102, Coedge4_EH = 94, Coedge5_EH = 108, Loop0_ABCD = 7,
  Loop1_ABFE = 35, Loop2_FBDG = 57, Loop3_GDCH = 75, Loop4_EFGH = 93,
  Loop5_EHCA = 107, FaceABCD = 5, FaceABFE = 33, FaceFBDG = 55,
  FaceGDCH = 73, FaceEFGH = 91, FaceEHCA = 105
}
 

Functions

Dtk_BodyPtr CreateAxis ()
 Creates a reference body (infinite + reference flags) containing a single named axis line with metadata. More...
 
Dtk_AxisSystemPtr CreateAxisSystem ()
 Creates a named axis system with a custom orientation matrix, red color, layer 123, and metadata. More...
 
Dtk_BodyPtr CreateConstructionPlane ()
 Creates a construction plane body: an infinite plane at Y=50, returned as an open shell. More...
 
Dtk_BodyPtr CreateCube ()
 Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex, Edge, Coedge, Loop, Face, Shell, Volume, Lump), assigns named topology entities, per-face colors, IDs, and metadata. More...
 
Dtk_BodyPtr CreateCube_2 ()
 Creates a 100x100x100 mm BRep cube body augmented with face IDs (required for FDT linking), solid validation properties (area, volume, centre of gravity) and a face-level user attribute. More...
 
Dtk_RenderInfosPtr CreateCubeRenderInfos ()
 Creates a Dtk_RenderInfos object with ambient, diffuse, and specular lighting and a texture for use on a cube mesh. More...
 
Dtk_BodyPtr CreateCurves ()
 Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct color and name. More...
 
Dtk_BodyPtr CreateCurves_2 ()
 Creates a wireframe body with colored curves, augmented with additional curve-level attributes. More...
 
Dtk_BodyPtr CreateCurvesStyle ()
 Creates a wireframe body demonstrating curve display styles: thick circle (4 mm), dashed blue circle, and dotted magenta circle (2 mm). More...
 
Dtk_BodyPtr CreateCyl (double radius, double height)
 Creates a BRep cylinder body with the given radius and height using analytical cylindrical and planar surfaces. More...
 
Dtk_BodyPtr CreateCylinder ()
 Creates a closed BRep cylinder body (radius 50, height 100) with two circular faces, a lateral cylindrical face, named face IDs, validation properties, and mesh tessellation. More...
 
Dtk_FdtPtr CreateDimension ()
 Creates a linear dimension FDT with a leader, dual-value text, and a frame. More...
 
Dtk_BodyPtr CreateEsquisse2D ()
 Creates a 2D wireframe sketch body (planar, lying in the XY plane) containing lines, arc circles, circles, ellipses, and arc ellipses. More...
 
Dtk_BodyPtr CreateEsquisse3D ()
 Creates a 3D wireframe sketch body containing points, lines, NURBS splines, circles, arc circles, ellipses, and arc ellipses. More...
 
Dtk_FdtPtr CreateFdtDatum ()
 Creates simple Datum. More...
 
Dtk_FdtPtr CreateGeometricalTolerance ()
 Creates a geometric tolerance FDT: cylindricity position tolerance | 0.02(M) | A |. More...
 
Dtk_BodyPtr CreateInfinitePlane ()
 Creates a reference body flagged as an infinite plane (InfiniteGeometryFlag + RefEntityFlag), with color and metadata. More...
 
Dtk_MeshPtr CreateMeshCube ()
 Mesh Cube sample. More...
 
Dtk_MeshPtr CreateMeshCubeVertexColor ()
 Creates a unit cube mesh with per-vertex color data (red, green, blue, white cycling per face). More...
 
Dtk_MeshPtr CreateMeshCuboid (const Dtk_pnt &inFirstPoint, const Dtk_pnt &inSecondPoint)
 Creates an axis-aligned cuboid mesh from two opposite corner points. More...
 
Dtk_MeshPtr CreateMeshCylinder (int nbpoints)
 Mesh Cylinder sample. More...
 
Dtk_MeshPtr CreateMeshPoints ()
 Points mesh sample. More...
 
Dtk_MeshPtr CreateMeshWire ()
 Wire mesh sample. More...
 
Dtk_BodyPtr CreateMixedBody ()
 Creates a mixed body combining a closed BRep cube (solid) with additional free surfaces and wireframe curves in the same body. More...
 
Dtk_ModelDisplayPtr CreateModelDisplayActivated ()
 Creates an activated (visible) model display "MyView1" with a perspective camera. More...
 
Dtk_ModelDisplayPtr CreateModelDisplayDesactivated ()
 Creates a deactivated (hidden) model display "MyView2" with an orthographic camera. More...
 
Dtk_ModelDisplayPtr CreateModelDisplayWithSection ()
 Creates a deactivated model display "MySectionView" with a section cut plane applied. More...
 
Dtk_BodyPtr CreateOpenShell ()
 Creates an open shell body containing a single trimmed cylindrical surface (half cylinder, not closed). More...
 
Dtk_BodyPtr CreateOpenShell_2 ()
 Creates an open shell body (trimmed cylindrical surface) augmented with open-shell attributes. More...
 
Dtk_BodyPtr CreatePoint ()
 Creates a wireframe body containing a single named red point with metadata. More...
 
Dtk_MeshPtr CreateTexturedMeshCube (const Dtk_string &inImageDirectory)
 Textured Mesh Cube sample. More...
 
void FillFacesColors (Dtk_MeshPtr &inoutCubeMesh)
 Filling mesh faces with colors. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Lump 
Volume 
Shell 
Vertex_A 
Vertex_B 
Vertex_C 
Vertex_D 
Vertex_E 
Vertex_F 
Vertex_G 
Vertex_H 
Edge_AB 
Edge_CA 
Edge_DC 
Edge_BD 
Edge_EA 
Edge_FB 
Edge_FE 
Edge_GD 
Edge_GF 
Edge_HC 
Edge_HG 
Edge_EH 
Coedge0_AB 
Coedge1_AB 
Coedge0_CA 
Coedge5_CA 
Coedge0_DC 
Coedge3_DC 
Coedge0_BD 
Coedge2_BD 
Coedge1_EA 
Coedge5_EA 
Coedge1_FB 
Coedge2_FB 
Coedge1_FE 
Coedge2_GD 
Coedge3_GD 
Coedge4_FE 
Coedge2_GF 
Coedge4_GF 
Coedge3_HC 
Coedge5_HC 
Coedge3_HG 
Coedge4_HG 
Coedge4_EH 
Coedge5_EH 
Loop0_ABCD 
Loop1_ABFE 
Loop2_FBDG 
Loop3_GDCH 
Loop4_EFGH 
Loop5_EHCA 
FaceABCD 
FaceABFE 
FaceFBDG 
FaceGDCH 
FaceEFGH 
FaceEHCA 
17  {
18  Lump = 1,
19  Volume = 2,
20  Shell = 3,
21  Vertex_A = 9,
22  Vertex_B = 11,
23  Vertex_C = 17,
24  Vertex_D = 23,
25  Vertex_E = 37,
26  Vertex_F = 45,
27  Vertex_G = 63,
28  Vertex_H = 81,
29  Edge_AB = 14,
30  Edge_CA = 20,
31  Edge_DC = 26,
32  Edge_BD = 30,
33  Edge_EA = 40,
34  Edge_FB = 48,
35  Edge_FE = 52,
36  Edge_GD = 66,
37  Edge_GF = 70,
38  Edge_HC = 84,
39  Edge_HG = 88,
40  Edge_EH = 96,
41  Coedge0_AB = 8,
42  Coedge1_AB = 42,
43  Coedge0_CA = 16,
44  Coedge5_CA = 112,
45  Coedge0_DC = 22,
46  Coedge3_DC = 78,
47  Coedge0_BD = 28,
48  Coedge2_BD = 60,
49  Coedge1_EA = 36,
50  Coedge5_EA = 114,
51  Coedge1_FB = 44,
52  Coedge2_FB = 58,
53  Coedge1_FE = 50,
54  Coedge2_GD = 62,
55  Coedge3_GD = 76,
56  Coedge4_FE = 98,
57  Coedge2_GF = 68,
58  Coedge4_GF = 100,
59  Coedge3_HC = 80,
60  Coedge5_HC = 110,
61  Coedge3_HG = 86,
62  Coedge4_HG = 102,
63  Coedge4_EH = 94,
64  Coedge5_EH = 108,
65  Loop0_ABCD = 7,
66  Loop1_ABFE = 35,
67  Loop2_FBDG = 57,
68  Loop3_GDCH = 75,
69  Loop4_EFGH = 93,
70  Loop5_EHCA = 107,
71  FaceABCD = 5,
72  FaceABFE = 33,
73  FaceFBDG = 55,
74  FaceGDCH = 73,
75  FaceEFGH = 91,
76  FaceEHCA = 105,
77  };

Function Documentation

◆ CreateAxis()

Dtk_BodyPtr sampleWriter::CreateAxis ( )

Creates a reference body (infinite + reference flags) containing a single named axis line with metadata.

Creates a reference axis containing a named axis, flagged as infinite geometry.

1569  {
1570  Dtk_BodyPtr mybody = Dtk_Body::Create();
1571  Dtk_ShellPtr shell = Dtk_Shell::Create( mybody );
1572  Dtk_tab<Dtk_CurvePtr> CurveArray;
1573 
1574  mybody->info() = Dtk_Info::Create();
1575  mybody->get_info()->SetInfiniteGeometryFlag( DTK_TRUE );
1576  mybody->get_info()->SetRefEntityFlag( DTK_TRUE );
1577 
1578 
1579  Dtk_LinePtr lineptr = Dtk_Line::Create( Dtk_pnt( -41, -42, -50 ), Dtk_pnt( -51, -52, -50 ) );
1580  lineptr->info() = Dtk_Info::Create();
1581  lineptr->info()->SetColor( Dtk_RGB( 0, 255, 25, 255 ) );
1582  lineptr->info()->SetName( L"myaxe" );
1583 
1584 
1585  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myaxe", L"Value of myaxe" );
1586  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1587  ArrayMetadataEntity.push_back( metadata );
1588  lineptr->info()->SetMetaData( ArrayMetadataEntity );
1589 
1590  CurveArray.push_back( Dtk_CurvePtr::DtkDynamicCast( lineptr ) );
1591 
1592  shell->AddWire( CurveArray );
1593  mybody->AddWireShell( shell );
1594 
1595  return mybody;
1596  }

◆ CreateAxisSystem()

Dtk_AxisSystemPtr sampleWriter::CreateAxisSystem ( )

Creates a named axis system with a custom orientation matrix, red color, layer 123, and metadata.

Creates a named axis system with a custom orientation, color, layer, and metadata.

1542  {
1544  Dtk_transfo dtk_transfo;
1545  dtk_transfo.setXdir( 0.0, 0.0, 1.0 );
1546  dtk_transfo.setYdir( -1.0, 0.0, 0.0 );
1547  dtk_transfo.setZdir( 0.0, -1.0, 0.0 );
1548  dtk_transfo.setOrigin( Dtk_pnt( -41, -42, -50 ) );
1549  mycsystem->SetMatrix( dtk_transfo );
1550  mycsystem->info() = Dtk_Info::Create();
1551  mycsystem->info()->SetName( L"mycsystem" );
1552  mycsystem->info()->SetColor( Dtk_RGB( 255, 0, 0, 255 ) );
1553  mycsystem->info()->SetLayer( 123 );
1554 
1555 
1556  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mycsystem", L"Value of mycsystem" );
1557  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1558  ArrayMetadataEntity.push_back( metadata );
1559  mycsystem->info()->SetMetaData( ArrayMetadataEntity );
1560 
1561  //Uncomment to put the AxisSystem as Blanked
1562  //mycsystem->info()->SetBlankedStatus(DTK_TRUE);
1563 
1564  return mycsystem;
1565  }

◆ CreateConstructionPlane()

Dtk_BodyPtr sampleWriter::CreateConstructionPlane ( )

Creates a construction plane body: an infinite plane at Y=50, returned as an open shell.

Creates a body containing a construction (reference) plane at the origin.

1155  {
1156  Dtk_BodyPtr body = Dtk_Body::Create();
1157  Dtk_PlaneSurfacePtr plan = Dtk_PlaneSurface::Create( Dtk_pnt( 0., 50., 0. ), Dtk_dir( 0., 1., 0. ), Dtk_dir( 1., 0., 0. ) );
1158  Dtk_FacePtr face = Dtk_Face::Create( body );
1159  face->SetGeom( Dtk_SurfacePtr::DtkDynamicCast( plan ) );
1160  Dtk_ShellPtr shell = Dtk_Shell::Create( body );
1161  shell->AddFace( face, DTK_TRUE );
1162  body->AddOpenShell( shell );
1163  body->info() = Dtk_Info::Create();
1164  body->info()->SetName( "Plane Y=50" );
1165  return body;
1166  }

◆ CreateCube()

Dtk_BodyPtr sampleWriter::CreateCube ( )

Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex, Edge, Coedge, Loop, Face, Shell, Volume, Lump), assigns named topology entities, per-face colors, IDs, and metadata.

Creates a 100x100x100 mm closed BRep cube body with 6 faces, named topology entities, and metadata.

1326  {
1327  std::map<Dtk_ID, Dtk_EntityPtr> array_topo;
1328 
1329  Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
1330  body->info() = Dtk_Info::Create();
1331  body->info()->SetName( L"Body" );
1332 
1333  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of Body", L"Value of Body" );
1334  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1335  ArrayMetadataEntity.push_back( metadata );
1336  body->info()->SetMetaData( ArrayMetadataEntity );
1337 
1338  CreateTopoVertex( array_topo, body ); //create all Vertex
1339  CreateTopoEdge( array_topo, body ); //create all Edge
1340  CreateTopoCoEdge( array_topo, body );//create all Coedge
1341  CreateTopoLoop( array_topo, body );//create all Loop
1342  CreateTopoFace( array_topo, body );//create all Face
1343  CreateTopoShell( array_topo, body );//create all Shell
1344  CreateTopoVolume( array_topo, body );//create all Volume
1345  CreateTopoLump( array_topo, body );//create all Lump
1346 
1347  body->AddLump( Dtk_LumpPtr::DtkDynamicCast( array_topo[ Lump ] ) ); // add the Lump into the body.
1348 
1349  return body;
1350  }

◆ CreateCube_2()

Dtk_BodyPtr sampleWriter::CreateCube_2 ( )

Creates a 100x100x100 mm BRep cube body augmented with face IDs (required for FDT linking), solid validation properties (area, volume, centre of gravity) and a face-level user attribute.

Creates a 100x100x100 mm BRep cube body augmented with face IDs required for FDT attachment, validation properties, and face-level user attributes.

1065  {
1066  std::map<Dtk_ID, Dtk_EntityPtr> array_topo;
1067 
1068  Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
1069 
1070  CreateTopoVertex_2( array_topo, body ); //create all Vertex
1071  CreateTopoEdge_2( array_topo, body ); //create all Edge
1072  CreateTopoCoEdge_2( array_topo, body );//create all Coedge
1073  CreateTopoLoop_2( array_topo, body );//create all Loop
1074  CreateTopoFace_2( array_topo, body );//create all Face
1075  CreateTopoShell_2( array_topo, body );//create all Shell
1076  CreateTopoVolume_2( array_topo, body );//create all Volume
1077  CreateTopoLump_2( array_topo, body );//create all Lump
1078 
1079  body->AddLump( Dtk_LumpPtr::DtkDynamicCast( array_topo[ 1 ] ) ); // add the Lump into the body.
1080 
1081  // V78 : val prop sur Body : IGNORED
1082  Dtk_InfoPtr& body_info = body->info();
1083  if( body_info.IsNULL() ) body_info = Dtk_Info::Create();
1084  Dtk_Val valprop_area( "1234 mm2" );
1085  body_info->AddAttribute( "geometric validation property : : surface area measure", valprop_area );
1086  Dtk_Val valprop_volume( "5678 mm3" );
1087  body_info->AddAttribute( "geometric validation property : : volume measure", valprop_volume );
1088  Dtk_Val valprop_CG( Dtk_pnt( 12., 34., 56. ) );
1089  body_info->AddAttribute( "geometric validation property : : centre point", valprop_CG );
1090 
1091  return body;
1092  }

◆ CreateCubeRenderInfos()

Dtk_RenderInfosPtr sampleWriter::CreateCubeRenderInfos ( )

Creates a Dtk_RenderInfos object with ambient, diffuse, and specular lighting and a texture for use on a cube mesh.

Creates a Dtk_RenderInfos object with material and color information for a cube.

502  {
503  //Variables
504  Dtk_RGB ambiant;
505  Dtk_RGB diffuse;
506  Dtk_RGB specular;
507  Dtk_LightMapPtr lightMap;
508  Dtk_TextureInfosPtr texture;
509  Dtk_string fileName;
510 
511  //Creating lighting
512  ambiant.SetRGBA( 255, 255, 255 );
513  diffuse.SetRGBA( 255, 255, 255 );
514  specular.SetRGBA( 255, 255, 255 );
515  lightMap = Dtk_LightMap::Create( ambiant, diffuse, specular );
516 
517  lightMap->SetTransparentRatio( 0.0 );
518 
519  Dtk_RGB reflective;
520  reflective.SetRGBA( 255, 255, 255 );
521  lightMap->AddReflectiveColor( reflective );
522 
523  lightMap->SetShininessRatio( 0.003375 );
524 
525  //Creating texture using cubical mapping
527  //Setting image to the texture
528  fileName = "..\\InputFiles\\Images\\sample.bmp";
529  texture->SetImagePath( fileName );
530  //Scaling the texture
531  texture->SetScale( 2, 2 );
532 
533  //Finally creating render informations
534  Dtk_RenderInfosPtr renderInfo = Dtk_RenderInfos::Create( "Rendering", lightMap, texture );
535 
536  return renderInfo;
537  }

◆ CreateCurves()

Dtk_BodyPtr sampleWriter::CreateCurves ( )

Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct color and name.

Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct color.

1369  {
1370  Dtk_tab<Dtk_CurvePtr> mycurves;
1371  Dtk_BodyPtr mybody;
1372  mybody = Dtk_Body::Create();
1373  Dtk_ShellPtr myshell;
1374  myshell = Dtk_Shell::Create( mybody );
1375 
1376  Dtk_EllipsePtr myellipse;
1377 
1378  //add circle curve
1379  myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1380  Dtk_CurvePtr mycurve;
1381  mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
1382  mycurve->info() = Dtk_Info::Create();
1383  mycurve->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
1384  mycurve->info()->SetName( "mycircle" );
1385  mycurves.push_back( mycurve );
1386 
1387 
1388  //add ellipse curve
1389  myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0, 5.0 );
1390  mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
1391  mycurve->info() = Dtk_Info::Create();
1392  mycurve->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
1393  mycurve->info()->SetName( "myellipse" );
1394  mycurves.push_back( mycurve );
1395 
1396 
1397  //add line curve
1398  Dtk_LinePtr myline;
1399  myline = Dtk_Line::Create( Dtk_pnt( -5.0, 0.0, 0.0 ), Dtk_pnt( 5.0, 0.0, 0.0 ) );
1400  mycurve = Dtk_CurvePtr::DtkDynamicCast( myline );
1401  mycurve->info() = Dtk_Info::Create();
1402  mycurve->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
1403  mycurve->info()->SetName( "myline" );
1404  mycurves.push_back( mycurve );
1405 
1406 
1407  //add nurbs curve
1408  //nurbs with 4 Control Points
1409  //respect num_points = Knots.size() - Degree - 1;
1410  Dtk_tab<Dtk_pnt> ControlPoints;
1411  Dtk_tab<Dtk_Double64> Knots;
1412  Dtk_Int32 Degree = 3;
1413  ControlPoints.resize( 4 );
1414  ControlPoints[ 0 ] = Dtk_pnt( -5.0, 0.0, 0.0 );
1415  ControlPoints[ 1 ] = Dtk_pnt( -2.0, 5.0, 0. );
1416  ControlPoints[ 2 ] = Dtk_pnt( 2.0, -5.0, 0. );
1417  ControlPoints[ 3 ] = Dtk_pnt( 5.0, 0.0, 0. );
1418  Knots.resize( 8 );
1419  Knots[ 0 ] = Knots[ 1 ] = Knots[ 2 ] = Knots[ 3 ] = 0.0;
1420  Knots[ 4 ] = Knots[ 5 ] = Knots[ 6 ] = Knots[ 7 ] = 1.0;
1421 
1422  Dtk_NurbsCurvePtr cnurbs = Dtk_NurbsCurve::Create( Degree, Knots, ControlPoints );
1423  mycurve = Dtk_CurvePtr::DtkDynamicCast( cnurbs );
1424  mycurve->info() = Dtk_Info::Create();
1425  mycurve->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
1426  mycurve->info()->SetName( "mynurbs" );
1427  mycurves.push_back( mycurve );
1428 
1429 
1430 
1431  myshell->AddWire( mycurves );
1432  mybody->AddWireShell( myshell );
1433 
1434 
1435  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mycurve", L"Value of mycurve" );
1436  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1437  ArrayMetadataEntity.push_back( metadata );
1438 
1439  mybody->info() = Dtk_Info::Create();
1440  mybody->info()->SetMetaData( ArrayMetadataEntity );
1441 
1442  return mybody;
1443  }

◆ CreateCurves_2()

Dtk_BodyPtr sampleWriter::CreateCurves_2 ( )

Creates a wireframe body with colored curves, augmented with additional curve-level attributes.

Creates a wireframe body with colored curves, augmented with additional attributes.

1111  {
1112  Dtk_tab<Dtk_CurvePtr> mycurves;
1113  Dtk_BodyPtr mysbody;
1114  mysbody = Dtk_Body::Create();
1115 
1116  Dtk_ShellPtr myshell;
1117  myshell = Dtk_Shell::Create( mysbody );
1118 
1119  Dtk_EllipsePtr myellipse;
1120  myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1121 
1122  Dtk_CurvePtr mycurve;
1123  mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
1124 
1125  mycurve->info() = Dtk_Info::Create();
1126  mycurve->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
1127  mycurve->info()->SetName( "mycircle" );
1128 
1129  mycurves.push_back( mycurve );
1130 
1131  Dtk_LinePtr myline;
1132  myline = Dtk_Line::Create( Dtk_pnt( -5.0, 0.0, 0.0 ), Dtk_pnt( 5.0, 0.0, 0.0 ) );
1133  mycurve = Dtk_CurvePtr::DtkDynamicCast( myline );
1134 
1135  mycurve->info() = Dtk_Info::Create();
1136  mycurve->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
1137  mycurve->info()->SetName( "myline" );
1138 
1139  mycurves.push_back( mycurve );
1140 
1141  myshell->AddWire( mycurves );
1142  mysbody->AddWireShell( myshell );
1143 
1144  // Val Prop on Body : not yet supported
1145  Dtk_InfoPtr& body_info = mysbody->info();
1146  if( body_info.IsNULL() ) body_info = Dtk_Info::Create();
1147  Dtk_Val valprop_curve_length( "1234 mm" );
1148  body_info->AddAttribute( "geometric validation property : : curve length measure", valprop_curve_length );
1149 
1150  return mysbody;
1151  }

◆ CreateCurvesStyle()

Dtk_BodyPtr sampleWriter::CreateCurvesStyle ( )

Creates a wireframe body demonstrating curve display styles: thick circle (4 mm), dashed blue circle, and dotted magenta circle (2 mm).

Creates a wireframe body demonstrating curve display styles: custom thickness and dashed/dotted line types.

1448  {
1449  Dtk_tab<Dtk_CurvePtr> mycurves;
1450  Dtk_BodyPtr mybody;
1451  mybody = Dtk_Body::Create();
1452  Dtk_ShellPtr myshell;
1453  myshell = Dtk_Shell::Create( mybody );
1454 
1455  Dtk_EllipsePtr ellipsethick = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1456  ellipsethick->info() = Dtk_Info::Create();
1457  ellipsethick->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1458  ellipsethick->info()->SetCurveThickNessInMM( 4 );
1459  mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsethick ) );
1460 
1461 
1462  Dtk_EllipsePtr ellipsedash = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 6.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1463  ellipsedash->info() = Dtk_Info::Create();
1464  ellipsedash->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
1465  ellipsedash->info()->SetCurveLineType( DTK_DASHED );
1466  mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsedash ) );
1467 
1468  Dtk_EllipsePtr ellipsedotted = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 7.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1469  ellipsedotted->info() = Dtk_Info::Create();
1470  ellipsedotted->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
1471  ellipsedotted->info()->SetCurveLineType( DTK_DOTTED );
1472  ellipsedotted->info()->SetCurveThickNessInMM( 2 );
1473  mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsedotted ) );
1474 
1475  myshell->AddWire( mycurves );
1476  mybody->AddWireShell( myshell );
1477  mybody->info() = Dtk_Info::Create();
1478 
1479  return mybody;
1480  }

◆ CreateCyl()

Dtk_BodyPtr sampleWriter::CreateCyl ( double  radius,
double  height 
)

Creates a BRep cylinder body with the given radius and height using analytical cylindrical and planar surfaces.

Creates a BRep cylinder body with the given radius and height.

1771  {
1772  Dtk_BodyPtr body = Dtk_Body::Create();
1773  Dtk_LumpPtr lump = Dtk_Lump::Create( body );
1774  Dtk_VolumePtr volume = Dtk_Volume::Create( body );
1775  Dtk_ShellPtr shell = Dtk_Shell::Create( body );
1776  body->AddLump( lump );
1777  lump->AddVolume( volume );
1778  volume->AddOuterShell( shell );
1779 
1780  Dtk_pnt P[ 4 ];
1781  P[ 0 ] = Dtk_pnt( radius, 0, 0 );
1782  P[ 1 ] = Dtk_pnt( radius, 0, height );
1783  P[ 2 ] = Dtk_pnt( -radius, 0, height );
1784  P[ 3 ] = Dtk_pnt( -radius, 0, 0 );
1785  Dtk_VertexPtr v[ 4 ];
1786  Dtk_Size_t i;
1787  for( i = 0; i < 4; i++ )
1788  v[ i ] = MakeVertex( body, P[ i ] );
1789  Dtk_EdgePtr e[ 6 ];
1790  e[ 0 ] = MakeEdge( body, v[ 0 ], v[ 1 ], MakeSegment( P[ 0 ], P[ 1 ] ), 1 );
1791  e[ 1 ] = MakeEdge( body, v[ 2 ], v[ 3 ], MakeSegment( P[ 2 ], P[ 3 ] ), 2 );
1792  e[ 2 ] = MakeEdge( body, v[ 3 ], v[ 0 ], MakeArc2D( Dtk_pnt(), radius, -DTK_PI, 0 ), 3 );
1793  e[ 3 ] = MakeEdge( body, v[ 0 ], v[ 3 ], MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ), 4 );
1794  e[ 4 ] = MakeEdge( body, v[ 2 ], v[ 1 ], MakeArc2D( Dtk_pnt( 0, 0, height ), radius, -DTK_PI, 0 ), 5 );
1795  e[ 5 ] = MakeEdge( body, v[ 1 ], v[ 2 ], MakeArc2D( Dtk_pnt( 0, 0, height ), radius, 0, DTK_PI ), 6 );
1796 
1797  Dtk_FacePtr half1 = MakeOuterFace( body, MakeCyl( Dtk_pnt(), radius, height ),
1798  MakeCoedge( body, e[ 0 ], DTK_TRUE, MakeSegment2D( 0, 0, 0, height ) ),
1799  MakeCoedge( body, e[ 4 ], DTK_FALSE, MakeSegment2D( 0, height, -DTK_PI, height ) ),
1800  MakeCoedge( body, e[ 1 ], DTK_TRUE, MakeSegment2D( -DTK_PI, height, -DTK_PI, 0 ) ),
1801  MakeCoedge( body, e[ 2 ], DTK_TRUE, MakeSegment2D( -DTK_PI, 0, 0, 0 ) )
1802  );
1803  shell->AddFace( half1, DTK_TRUE );
1804  FillInfos( half1->info(), 1, Dtk_RGB() );
1805 
1806  Dtk_FacePtr half2 = MakeOuterFace( body, MakeCyl( Dtk_pnt(), radius, height ),
1807  MakeCoedge( body, e[ 3 ], DTK_TRUE, MakeSegment2D( 0, 0, DTK_PI, 0 ) ),
1808  MakeCoedge( body, e[ 1 ], DTK_FALSE, MakeSegment2D( DTK_PI, 0, DTK_PI, height ) ),
1809  MakeCoedge( body, e[ 5 ], DTK_FALSE, MakeSegment2D( DTK_PI, height, 0, height ) ),
1810  MakeCoedge( body, e[ 0 ], DTK_FALSE, MakeSegment2D( 0, height, 0, 0 ) )
1811  );
1812  shell->AddFace( half2, DTK_TRUE );
1813  FillInfos( half2->info(), 2, Dtk_RGB() );
1814 
1815  Dtk_FacePtr plandown = MakeOuterFace( body, MakePlane( Dtk_pnt(), Dtk_dir( 0, 0, -1 ), radius ),
1816  MakeCoedge( body, e[ 2 ], DTK_FALSE, MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ) ),
1817  MakeCoedge( body, e[ 3 ], DTK_FALSE, MakeArc2D( Dtk_pnt(), radius, DTK_PI, 2 * DTK_PI ) ),
1818  NULL, NULL
1819  );
1820  shell->AddFace( plandown, DTK_TRUE );
1821  FillInfos( plandown->info(), 3, Dtk_RGB() );
1822 
1823  Dtk_FacePtr planup = MakeOuterFace( body, MakePlane( Dtk_pnt( 0, 0, height ), Dtk_dir( 0, 0, 1 ), radius ),
1824  MakeCoedge( body, e[ 4 ], DTK_TRUE, MakeArc2D( Dtk_pnt(), radius, -DTK_PI, 0 ) ),
1825  MakeCoedge( body, e[ 5 ], DTK_TRUE, MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ) ),
1826  NULL, NULL
1827  );
1828  shell->AddFace( planup, DTK_TRUE );
1829  FillInfos( planup->info(), 4, Dtk_RGB( 0, 255, 0 ) );
1830  body->info() = Dtk_Info::Create();
1831 
1832  return body;
1833  }

◆ CreateCylinder()

Dtk_BodyPtr sampleWriter::CreateCylinder ( )

Creates a closed BRep cylinder body (radius 50, height 100) with two circular faces, a lateral cylindrical face, named face IDs, validation properties, and mesh tessellation.

Creates a closed BRep cylinder body with its triangulated tessellation, ready for writing.

1181  {
1182  Dtk_BodyPtr mysbody;
1183  mysbody = Dtk_Body::Create();
1184 
1185  // Curves of edges
1186  Dtk_PointPtr P1 = Dtk_Point::Create( 50., 0., 100. );
1187  Dtk_PointPtr P2 = Dtk_Point::Create( 50., 0., 0. );
1188  Dtk_pnt cent1( 0., 0., 100. );
1189  Dtk_EllipsePtr circ1 = Dtk_Ellipse::Create( cent1, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50. );
1190  Dtk_pnt cent2( 0., 0., 0. );
1191  Dtk_EllipsePtr circ2 = Dtk_Ellipse::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50. );
1192  Dtk_LinePtr seam = Dtk_Line::Create( Dtk_pnt( 50., 0., 0. ), Dtk_pnt( 50., 0., 100. ) );
1193  // Surfaces of faces
1194  // Notice : for tessellation, it is required to record the UV trim in surfaces
1195  double trim[ 4 ];
1196  Dtk_PlaneSurfacePtr plan1 = Dtk_PlaneSurface::Create( cent1, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ) );
1197  trim[ 0 ] = -100.; trim[ 1 ] = 100.; trim[ 2 ] = -100.; trim[ 3 ] = 100.;
1198  plan1->SetTrimUVBox( trim );
1199  Dtk_PlaneSurfacePtr plan2 = Dtk_PlaneSurface::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ) );
1200  plan2->SetTrimUVBox( trim );
1201  Dtk_CylindricalSurfacePtr cylsurf = Dtk_CylindricalSurface::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50 );
1202  trim[ 0 ] = 0.; trim[ 1 ] = 2. * DTK_PI;
1203  cylsurf->SetTrimUVBox( trim );
1204 
1205  // Topology
1206  // Vertices
1207  Dtk_VertexPtr V1 = Dtk_Vertex::Create( mysbody );
1208  V1->SetGeom( P1 );
1209  Dtk_VertexPtr V2 = Dtk_Vertex::Create( mysbody );
1210  V2->SetGeom( P2 );
1211  // Edges
1212  Dtk_EdgePtr E0 = Dtk_Edge::Create( mysbody );
1213  E0->SetGeom( Dtk_CurvePtr::DtkDynamicCast( seam ) );
1214  E0->SetStartVertex( V1 );
1215  E0->SetEndVertex( V2 );
1216  Dtk_EdgePtr E1 = Dtk_Edge::Create( mysbody );
1217  E1->SetGeom( Dtk_CurvePtr::DtkDynamicCast( circ1 ) );
1218  E1->SetStartVertex( V1 );
1219  E1->SetEndVertex( V1 );
1220  Dtk_EdgePtr E2 = Dtk_Edge::Create( mysbody );
1221  E2->SetGeom( Dtk_CurvePtr::DtkDynamicCast( circ2 ) );
1222  E2->SetStartVertex( V2 );
1223  E2->SetEndVertex( V2 );
1224 
1225  // Faces
1226  Dtk_FacePtr F0 = Dtk_Face::Create( mysbody );
1227  F0->SetGeom( Dtk_SurfacePtr::DtkDynamicCast( cylsurf ) );
1228  SetTopoFaceID( F0, 10 );
1229  Dtk_FacePtr F1 = Dtk_Face::Create( mysbody );
1230  F1->SetGeom( Dtk_SurfacePtr::DtkDynamicCast( plan1 ) );
1231  SetTopoFaceID( F1, 20 );
1232  // test for face color different from body color
1233  F1->info()->SetColor( Dtk_RGB( 255, 0, 0 ) ); // info created by SetTopoFaceID
1234  Dtk_FacePtr F2 = Dtk_Face::Create( mysbody );
1235  F2->SetGeom( Dtk_SurfacePtr::DtkDynamicCast( plan2 ) );
1236  SetTopoFaceID( F2, 30 );
1237  // Loops + coedges
1238  Dtk_LoopPtr L0 = Dtk_Loop::Create( mysbody );
1239  Dtk_CoedgePtr C01 = Dtk_Coedge::Create( mysbody );
1240  C01->SetEdge( E1 );
1241  L0->AddCoedge( C01, DTK_FALSE );
1242  Dtk_CoedgePtr C02 = Dtk_Coedge::Create( mysbody );
1243  C02->SetEdge( E0 );
1244  L0->AddCoedge( C02, DTK_FALSE );
1245  Dtk_CoedgePtr C03 = Dtk_Coedge::Create( mysbody );
1246  C03->SetEdge( E2 );
1247  L0->AddCoedge( C03, DTK_TRUE );
1248  Dtk_CoedgePtr C04 = Dtk_Coedge::Create( mysbody );
1249  C04->SetEdge( E0 );
1250  L0->AddCoedge( C04, DTK_TRUE );
1251  F0->AddOuterLoop( L0 );
1252 
1253  Dtk_LoopPtr L1 = Dtk_Loop::Create( mysbody );
1254  Dtk_CoedgePtr C1 = Dtk_Coedge::Create( mysbody );
1255  C1->SetEdge( E1 );
1256  L1->AddCoedge( C1, DTK_TRUE );
1257  F1->AddOuterLoop( L1 );
1258 
1259  Dtk_LoopPtr L2 = Dtk_Loop::Create( mysbody );
1260  Dtk_CoedgePtr C2 = Dtk_Coedge::Create( mysbody );
1261  C2->SetEdge( E2 );
1262  L2->AddCoedge( C2, DTK_TRUE );
1263  F2->AddOuterLoop( L2 );
1264 
1265  // Shell, Volume
1266  Dtk_ShellPtr SH = Dtk_Shell::Create( mysbody );
1267  SH->AddFace( F0, DTK_TRUE );
1268  SH->AddFace( F1, DTK_TRUE );
1269  SH->AddFace( F2, DTK_FALSE );
1270  Dtk_VolumePtr VOL = Dtk_Volume::Create( mysbody );
1271  VOL->AddOuterShell( SH );
1272  Dtk_LumpPtr Lump = Dtk_Lump::Create( mysbody );
1273  Lump->AddVolume( VOL );
1274  mysbody->AddLump( Lump );
1275  if( mysbody->info().IsNULL() ) mysbody->info() = Dtk_Info::Create();
1276  mysbody->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );//Whole body color
1277 
1278  return mysbody;
1279  }

◆ CreateDimension()

Dtk_FdtPtr sampleWriter::CreateDimension ( )

Creates a linear dimension FDT with a leader, dual-value text, and a frame.

Creates a linear dimension FDT between two points.

113  {
114  Dtk_FdtPtr fdt = Dtk_Fdt::Create();
115 
117 
118 
119  // Creation of Text info
120  Dtk_InfoPtr text_info = Dtk_Info::Create();
121 
122  //Setting text style
123  Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
124  double slant = 0.;
125  Dtk_TextStyle text_style;
126  //Text height
127  text_style.CharHeight() = 3.5;
128  //Text width
129  text_style.CharWidth() = 2.1;
130  //Text slant
131  text_style.Slant() = slant;
132 
133  //Creating text value "200"
134  Dtk_string str( "200" );
135  //Creating text 2D Bounding box
136  Dtk_pnt location( -5., 20. );
137  double x_len = 15., y_len = 5.;
138  Dtk_dir x_dir( 1., 0., 0. ), y_dir( 0., 0., 1. );
139  Dtk_Oriented2dBBox inbox( location, x_len, y_len, x_dir, y_dir );
140 
143 
144  //Creating the text itself giving :
145  // - its value
146  // - inside and outside boxes
147  // - anchor type
148  // - text type
149  // - horizontal/vertical text orientation
150  // - text infos
151  // - text style
152  // - text slant - PI / 2.0 for normal text -
153  // - font index
154  // - mirroring type
155  Dtk_Text dtk_text( str, inbox, inbox, dtk_align, text_type, horiz_vert, text_info, text_style, slant, font_index, mirror );
156  Dtk_CompositeText texts;
157  texts.AddText( dtk_text );
158 
159  //Creating the Dimension itself
161  Dtk_DimensionPtr dimension = Dtk_Dimension::Create( dimensionType, texts );
162  //Adding dimension to FDT
163  fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( dimension );
164 
165  //Creating the Leader lines
166  //Setting leader terminator type
168  //Setting leader terminator size
169  double arrow_width = 5., arrow_length = 5.;
170  //Creating first leader
171  //Setting the Arrow location
172  Dtk_pnt leader1_arrow_location = Dtk_pnt( 100., 23., 0. );
173  //Setting the leader position
174  Dtk_transfo leader1_pos;
175  leader1_pos.setOrigin( Dtk_pnt( 0., 23., 0. ) );
176  //Setting the leader points
177  Dtk_tab<Dtk_pnt> leader1_pts;
178  leader1_pts.push_back( Dtk_pnt( 10., 23., 0. ) );
179  //Creating the first leader itself
180  Dtk_LeaderPtr leader1 = Dtk_Leader::Create( arrow_width, arrow_length, leader1_arrow_location, termintator_type, leader1_pts );
181  //Adding extension lines
182  Dtk_tab<Dtk_pnt> extension_line_1;
183  extension_line_1.push_back( Dtk_pnt( 100., 25. ) );
184  extension_line_1.push_back( Dtk_pnt( 100., 0. ) );
185  leader1->SetExtensionLine( Dtk_Polyline::Create( std::move( extension_line_1 ) ) );
186  dimension->AddLeader( leader1 );
187 
188  //Creating second leader
189  Dtk_transfo leader2_pos;
190  leader2_pos.setOrigin( Dtk_pnt( 0., 23., 0. ) );
191  Dtk_tab<Dtk_pnt> leader2_pts;
192  //Setting the Arrow location
193  Dtk_pnt leader2_arrow_location = Dtk_pnt( -100., 23., 0. );
194  leader2_pts.push_back( Dtk_pnt( -10., 23., 0. ) );
195  //Creating the second leader itself
196  Dtk_LeaderPtr leader2 = Dtk_Leader::Create( arrow_width, arrow_length, leader2_arrow_location, termintator_type, leader2_pts );
197  //Adding extension lines
198  Dtk_tab<Dtk_pnt> extension_line_2;
199  extension_line_2.push_back( Dtk_pnt( -100., 25. ) );
200  extension_line_2.push_back( Dtk_pnt( -100., 0. ) );
201  leader2->SetExtensionLine( Dtk_Polyline::Create( std::move( extension_line_2 ) ) );
202  dimension->AddLeader( leader2 );
203 
204  // General data of the FDT : position, color, name ..
205  Dtk_transfo fdt_transf;
206  fdt_transf.setOrigin( Dtk_pnt( 0., 200., 75. ) );
207  fdt_transf.setXdir( 0., 1., 0. );
208  fdt_transf.setYdir( -1., 0., 0. );
209  fdt->Transform( fdt_transf );
210 
211  Dtk_InfoPtr fdt_info = Dtk_Info::Create();
212  fdt_info->SetColor( 0, 255, 0 );
213  fdt_info->SetName( "Dimension:1" );
214  fdt->info() = fdt_info;
215 
216  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myfdt", L"Value of myfdt" );
217  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
218  ArrayMetadataEntity.push_back( metadata );
219  fdt->info()->SetMetaData( ArrayMetadataEntity );
220 
221  return fdt;
222  }

◆ CreateEsquisse2D()

Dtk_BodyPtr sampleWriter::CreateEsquisse2D ( )

Creates a 2D wireframe sketch body (planar, lying in the XY plane) containing lines, arc circles, circles, ellipses, and arc ellipses.

Creates a 2D wireframe sketch body (planar, XY plane) containing lines, arcs, circles, and ellipses.

1700  {
1701  Dtk_tab<Dtk_CurvePtr> ArrayCurve;
1702  Dtk_tab<Dtk_PointPtr> ArrayPoint;
1703 
1704  Dtk_PointPtr mypoint;
1705  mypoint = Dtk_Point::Create( Dtk_pnt( 1.0, 2.0, 0.0 ) );
1706  ArrayPoint.push_back( mypoint );
1707 
1708  Dtk_LinePtr line = Dtk_Line::Create( Dtk_pnt( 0.000000, 0.0, 0.0 ), Dtk_pnt( 1.0, 0.0, 0.0 ) );
1709  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
1710  line = Dtk_Line::Create( Dtk_pnt( 1.0, 1.0, 0.0 ), Dtk_pnt( 0.0, 1.0, 0.0 ) );
1711  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
1712 
1713  Dtk_EllipsePtr myarccircle;
1714  myarccircle = Dtk_Ellipse::Create( Dtk_pnt( 1.0, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.5, 0.5 );
1715  myarccircle->SetTrimmingParameters( -1.0 * DTK_PI / 2.0, DTK_PI / 2.0 );
1716  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarccircle ) );
1717 
1718  myarccircle = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.5, 0.5 );
1719  myarccircle->SetTrimmingParameters( DTK_PI / 2.0, 3.0 * DTK_PI / 2.0 );
1720  Dtk_NurbsCurvePtr nurbs = myarccircle->ToNurbs();
1721  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( nurbs ) );
1722 
1723  Dtk_EllipsePtr mycircle;
1724  mycircle = Dtk_Ellipse::Create( Dtk_pnt( -0.125, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25 );
1725  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( mycircle ) );
1726 
1727  Dtk_EllipsePtr myellipse;
1728  myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.25, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
1729  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
1730 
1731  Dtk_EllipsePtr myarcellipse;
1732  myarcellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.75, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
1733  myarcellipse->SetTrimmingParameters( -1.0 * DTK_PI / 2.0, DTK_PI / 2.0 );
1734  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarcellipse ) );
1735 
1736  myarcellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.75, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
1737  myarcellipse->SetTrimmingParameters( DTK_PI / 2.0, 3.0 * DTK_PI / 2.0 );
1738  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarcellipse ) );
1739 
1740 
1741  Dtk_BodyPtr mybody;
1742  mybody = Dtk_Body::Create();
1743 
1744  Dtk_ShellPtr myshell;
1745  myshell = Dtk_Shell::Create( mybody );
1746 
1747  myshell->AddWire( ArrayPoint );
1748  myshell->AddWire( ArrayCurve );
1749 
1750  mybody->AddWireShell( myshell );
1751 
1752  mybody->info() = Dtk_Info::Create();
1753  mybody->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1754  mybody->info()->SetName( L"CreateEsquisse2D" );
1755 
1756  Dtk_transfo transfo;
1757  transfo.setOrigin( -100.0, 0.0, 0.0 );
1758  transfo.setScale( 10.0 );
1759  mybody->Transform( transfo );
1760 
1761  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of esquisse2d", L"Value of esquisse2d" );
1762  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1763  ArrayMetadataEntity.push_back( metadata );
1764  mybody->info()->SetMetaData( ArrayMetadataEntity );
1765 
1766  return mybody;
1767  }

◆ CreateEsquisse3D()

Dtk_BodyPtr sampleWriter::CreateEsquisse3D ( )

Creates a 3D wireframe sketch body containing points, lines, NURBS splines, circles, arc circles, ellipses, and arc ellipses.

Creates a 3D wireframe sketch body containing points, lines, circles, arc circles, ellipses, arc ellipses, and NURBS.

1600  {
1601  Dtk_Size_t NbPoint = 2;
1602  Dtk_Size_t NbLine = 2;
1603  Dtk_Size_t Nbspline = 2;
1604  Dtk_Size_t NbCircle = 2;
1605  Dtk_Size_t NbArcCircle = 2;
1606  Dtk_Size_t NbEllipse = 2;
1607  Dtk_Size_t NbArcEllipse = 2;
1608 
1609 
1610  Dtk_tab<Dtk_PointPtr> ArrayPoint;
1611  Dtk_tab<Dtk_CurvePtr> ArrayCurve;
1612 
1613 
1614  for( Dtk_Size_t i = 0; i < NbPoint; i++ )
1615  {
1616  Dtk_PointPtr mypoint;
1617  mypoint = Dtk_Point::Create( Dtk_pnt( -10.0 + 10 * i, 2.0, 12.0 ) );
1618  mypoint->info() = Dtk_Info::Create();
1619  mypoint->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1620  Dtk_string name( L"mypoint" );
1621  name.add_int( ( int )i );
1622  mypoint->info()->SetName( name );
1623  ArrayPoint.push_back( mypoint );
1624  }
1625 
1626 
1627  Dtk_tab<Dtk_LinePtr> arraylineptr;
1628  for( Dtk_Size_t i = 0; i < NbLine; i++ )
1629  {
1630  Dtk_LinePtr line = Dtk_Line::Create( Dtk_pnt( -10.0 + 10 * i, 3, 10.0 ), Dtk_pnt( -10.0 + 10 * i, 9, 0.0 ) );
1631  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
1632  }
1633 
1634  for( Dtk_Size_t i = 0; i < Nbspline; i++ )
1635  {
1636  //add nurbs curve
1637  Dtk_EllipsePtr myellipse;
1638  myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 15, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 4.0, 2.5 );
1639  Dtk_NurbsCurvePtr nurbs = myellipse->ToNurbs();
1640  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( nurbs ) );
1641  }
1642 
1643  for( Dtk_Size_t i = 0; i < NbCircle; i++ )
1644  {
1645  //add nurbs curve
1646  Dtk_EllipsePtr myellipse;
1647  myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 22, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 4.0 );
1648  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
1649  }
1650 
1651  for( Dtk_Size_t i = 0; i < NbArcCircle; i++ )
1652  {
1653  //add nurbs curve
1654  Dtk_EllipsePtr myellipse;
1655  myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 30, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0 );
1656  myellipse->SetTrimmingParameters( 0.0, DTK_PI );
1657  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
1658  }
1659 
1660  for( Dtk_Size_t i = 0; i < NbEllipse; i++ )
1661  {
1662  Dtk_EllipsePtr myellipse;
1663  myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 35, 3.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0, 1.0 );
1664  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
1665  }
1666 
1667  for( Dtk_Size_t i = 0; i < NbArcEllipse; i++ )
1668  {
1669  Dtk_EllipsePtr myellipse;
1670  myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 40, 2.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0, 1.0 );
1671  myellipse->SetTrimmingParameters( 0.0, DTK_PI );
1672  ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
1673  }
1674 
1675  Dtk_BodyPtr mybody;
1676  mybody = Dtk_Body::Create();
1677 
1678  Dtk_ShellPtr myshell;
1679  myshell = Dtk_Shell::Create( mybody );
1680 
1681  myshell->AddWire( ArrayPoint );
1682  myshell->AddWire( ArrayCurve );
1683 
1684  mybody->AddWireShell( myshell );
1685 
1686  mybody->info() = Dtk_Info::Create();
1687  mybody->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1688  mybody->info()->SetName( L"CreateEsquisse3D" );
1689 
1690  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of esquisse3d", L"Value of esquisse3d" );
1691  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1692  ArrayMetadataEntity.push_back( metadata );
1693  mybody->info()->SetMetaData( ArrayMetadataEntity );
1694 
1695  return mybody;
1696  }

◆ CreateFdtDatum()

Dtk_FdtPtr sampleWriter::CreateFdtDatum ( )

Creates simple Datum.

Creates a simple datum FDT symbol ("A") with a leader, frame, and white text.

15  {
17 
18  // Creation of Leader line
19  Dtk_pnt arrow_location( 0., 0. );
20  Dtk_tab<Dtk_pnt> leader_points;
21  leader_points.push_back( Dtk_pnt( 0., 18. ) );
22  //Creation of leader with terminator's height and width 2.0. The terminator is a filled triangle
23  Dtk_LeaderPtr leader = Dtk_Leader::Create( 2.0, 2.0, arrow_location, Dtk_Leader::TerminatorTypeClosedArrow, leader_points );
24  //Creation of symbol
26 
27  // Creation of Text info
28  Dtk_InfoPtr text_info = Dtk_Info::Create();
29  //Setting text color to blue
30  text_info->SetColor( 0, 0, 255 );
31  //Setting text style
32  Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
33  double slant = 0.;
34  Dtk_TextStyle text_style;
35  //Text height
36  text_style.CharHeight() = 3.5;
37  //Text width
38  text_style.CharWidth() = 2.1;
39  //Text slant
40  text_style.Slant() = slant;
41 
42  //Text value : "A"
43  Dtk_string str( "A" );
44  //Creating text 2D Bounding box
45  Dtk_pnt location( -2., 20. );
46  double XLen = 5., YLen = 5.;
47  Dtk_dir XDir( 1., 0., 0. ), YDir( 0., 0., 1. );
48  Dtk_Oriented2dBBox inbox( location, XLen, YLen, XDir, YDir );
49 
52 
53  //Creating the text itself giving :
54  // - its value
55  // - inside and outside boxes
56  // - anchor type
57  // - text type
58  // - horizontal/vertical text orientation
59  // - text infos
60  // - text style
61  // - text slant - PI / 2.0 for normal text -
62  // - font index
63  // - mirroring type
64  Dtk_Text dtk_text( str, inbox, inbox, dtk_align, text_type, horiz_vert, text_info, text_style, slant, font_index, mirror );
65 
66  //Adding created text to symbol
67  Dtk_CompositeText& texts = symbol->Texts();
68  texts.AddText( dtk_text );
69 
70  //Creating the frame of the text
71  Dtk_tab< Dtk_CurvePtr > FrameGeoms;
72  Dtk_PolylinePtr framePolyline;
73  framePolyline = Dtk_Polyline::Create( Dtk_pnt( -5., 18. ), Dtk_pnt( 5., 18. ) );
74  framePolyline->AddPoint( Dtk_pnt( 5., 28. ) );
75  framePolyline->AddPoint( Dtk_pnt( -5., 28. ) );
76  framePolyline->AddPoint( Dtk_pnt( -5., 18. ) );
77  FrameGeoms.push_back( Dtk_CurvePtr::DtkDynamicCast( framePolyline ) );
78  //Setting the type of the frame
79  symbol->SetFrameType( DTK_FRAME_TYPE_RECTANGLE, FrameGeoms );
80 
81  // Creation of leader line
82  Dtk_InfoPtr leader_info = Dtk_Info::Create();
83  leader_info->SetColor( 255, 255, 255 );
84  leader->GetInfo() = leader_info;
85  //Adding leader to symbol
86  symbol->AddLeader( leader );
87  //Setting symbol type
88  symbol->SymbolType() = Dtk_Symbol::TypeDatum;
89  //Adding symbol to FDT
90  fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( symbol );
91 
92  //Adding transformation on FDT
93  Dtk_transfo fdt_transf;
94  fdt_transf.setOrigin( Dtk_pnt( 50., 100., 50. ) );
95  fdt->Transform( fdt_transf );
96 
97  //Adding infos on FDT (Name and color)
98  Dtk_InfoPtr fdt_info = Dtk_Info::Create();
99  fdt_info->SetColor( 255, 255, 255 );
100  fdt_info->SetName( "Datum:1" );
101  fdt->info() = fdt_info;
102 
103  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mydatum", L"Value of mydatum" );
104  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
105  ArrayMetadataEntity.push_back( metadata );
106  fdt->info()->SetMetaData( ArrayMetadataEntity );
107 
108  return fdt;
109  }

◆ CreateGeometricalTolerance()

Dtk_FdtPtr sampleWriter::CreateGeometricalTolerance ( )

Creates a geometric tolerance FDT: cylindricity position tolerance | 0.02(M) | A |.

Creates a geometric tolerance FDT (cylindricity tolerance) with a leader and frame.

226  {
227  Dtk_FdtPtr fdt = Dtk_Fdt::Create();
228  // first create and populate the dimension
229  // Creation of Text info
230  Dtk_InfoPtr text_info = Dtk_Info::Create();
231  //Setting text style
232  Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
233  double slant = 0.;
234  Dtk_TextStyle text_style;
235  Dtk_dir x_dir( 1, 0, 0 ), normal_dir( 0, 0, 1 );
236  //Text height
237  text_style.CharHeight() = 3.5;
238  //Text width
239  text_style.CharWidth() = 2.1;
240  //Text slant
241  text_style.Slant() = slant;
243 
244 
245 
246 
247  // Create boxes for Container Text
248  Dtk_pnt location_c( 0.0, 0.0 );
249  Dtk_Oriented2dBBox container_box( location_c, 15, 15, x_dir, normal_dir );// to give frame box
250  Dtk_Oriented2dBBox container_boxin = container_box; // to give inner smaller box for text
251  container_boxin.Extend( -2., -2. ); //reduce the initial box
252 
253 
254  //Create Dtk_GeometricalTolerance
256 
257  //Create Dtk_ToleranceSpecification
259 
260  //Create Dtk_ToleranceSpecificationContainer
262  MyGeometricalTolerance->AddToleranceSpecificationContainer( MyContainer );
263 
264 
265  //Create Fulltext for tolerance
266 
267  // Create tolerance
268  Dtk_CompositeText fulltext;
269  Dtk_Text val;
270  Dtk_pnt location_v( 15.0, 0.0 );
271  Dtk_Oriented2dBBox container_boxv( location_v, 20, 15, x_dir, normal_dir );
272  Dtk_Oriented2dBBox container_boxvin = container_boxv;
273  container_boxvin.Extend( -2., -2. );
274 
275 
276  val = Dtk_Text( L"0.02", container_boxvin, container_boxv, dtk_align, DTK_Text_type::dtk_text_type_value, horiz_vert, text_info, text_style, slant, font_index, mirror );
277  fulltext.AddText( val );
278 
279  // Create modifier
280  Dtk_pnt locationm( 35.0, 0.0 );
281  Dtk_Oriented2dBBox container_boxm( locationm, 15, 15, x_dir, normal_dir );
282  Dtk_Oriented2dBBox container_boxmin = container_boxm;
283  container_boxmin.Extend( -2., -2. );
284 
285  Dtk_Text modifier = Dtk_Text( L"\u24C2", container_boxmin, container_boxm, dtk_align, DTK_Text_type::dtk_text_type_modifier, horiz_vert, text_info, text_style, slant, font_index, mirror );
286  fulltext.AddText( modifier );
287 
288  // Create Reference Frame
290 
291  //Add A
292  Dtk_pnt locationA( 50.0, 0.0 );
293  Dtk_Oriented2dBBox container_boxA( locationA, 15, 15, x_dir, normal_dir );
294  Dtk_Oriented2dBBox container_boxAin = container_boxA;
295  container_boxAin.Extend( -2., -2. );
296 
297 
298  Dtk_ReferenceBlockPtr A_Block = Dtk_ReferenceBlock::Create( container_boxAin, container_boxA );
299  A_Block->AddReference( L"A" );
300  RefFrame->AddReferenceBlock( A_Block );
301 
302  // Create Dtk_ToleranceSpecificationPtr
303  Dtk_ToleranceSpecificationPtr MyToleranceSpecification = Dtk_ToleranceSpecification::Create( val, RefFrame );
304  MyToleranceSpecification->SetMainValue( fulltext );
305 
306  //Add it to Container
307  MyContainer->AddToleranceSpecification( MyToleranceSpecification );
308 
309  fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( MyGeometricalTolerance );
310 
311 
312  Dtk_InfoPtr fdt_info = Dtk_Info::Create();
313  fdt_info->SetColor( 255, 255, 255 );
314  fdt_info->SetName( "GeometricalTolerance" );
315  fdt->info() = fdt_info;
316 
317  return fdt;
318  }

◆ CreateInfinitePlane()

Dtk_BodyPtr sampleWriter::CreateInfinitePlane ( )

Creates a reference body flagged as an infinite plane (InfiniteGeometryFlag + RefEntityFlag), with color and metadata.

Creates a reference plane flagged as infinite , with color and metadata.

1512  {
1513  Dtk_BodyPtr mybody = Dtk_Body::Create();
1514  mybody->info() = Dtk_Info::Create();
1515  mybody->info()->SetInfiniteGeometryFlag( DTK_TRUE );
1516  mybody->get_info()->SetRefEntityFlag( DTK_TRUE );
1517 
1518  mybody->info()->SetColor( Dtk_RGB( 255, 0, 0, 255 ) );
1519  mybody->info()->SetName( L"myplan" );
1520 
1521  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myplan", L"Value of myplan" );
1522  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1523  ArrayMetadataEntity.push_back( metadata );
1524  mybody->info()->SetMetaData( ArrayMetadataEntity );
1525 
1526  Dtk_PlaneSurfacePtr plane = Dtk_PlaneSurface::Create( Dtk_pnt( -11, -12, -13 ), Dtk_dir( 0, 0, 1 ), Dtk_dir( 0, 1, 0 ) );
1527  Dtk_Double64 dom[ 4 ];
1528  dom[ 0 ] = 0.0;
1529  dom[ 1 ] = 10.0;
1530  dom[ 2 ] = 0.0;
1531  dom[ 3 ] = 10.0;
1532 
1533  plane->SetTrimUVBox( dom );
1534 
1535  mybody->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( plane ) );
1536 
1537  return mybody;
1538  }

◆ CreateMeshCube()

Dtk_MeshPtr sampleWriter::CreateMeshCube ( )

Mesh Cube sample.

Creates a unit cube triangulated mesh (12 triangles, 24 vertices with normals).

208  {
209  // Variables
210  Dtk_tab<Dtk_pnt> vertices;
211  Dtk_tab<Dtk_dir> normals;
212  Dtk_tab<Dtk_UInt32> indices;
213  Dtk_tab<Dtk_Float32> uCoords;
214  Dtk_tab<Dtk_Float32> vCoords;
215 
216  // Our mesh
217  Dtk_mesh* outCubeMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UV_TEXTURES /*if you have materials*/ ); // coords & normals & materials
218 
219  // PART1 : CREATING GEOMETRY AND UV COORDINATES ARRAYS (HARD CODED here)
220  CreateMeshCubeGeometry( vertices, normals, uCoords, vCoords );
221 
222 
223  // PART2 : STORING geometry (vertices & normals) into the mesh
224 
225  for( Dtk_Size_t i = 0; i < vertices.size(); i++ )
226  {
227  outCubeMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), NULL, uCoords[ i ], vCoords[ i ] );
228  }
229 
230  // At this point, vertices & normals are stored, but we have no faces yet
231 
232  // PART3 : BUILDING THE SIX FACES
233  CreateMeshCubeFaces( outCubeMesh );
234 
235  Dtk_RGB rgb( 255, 0, 0 );
236  outCubeMesh->set_mesh_color( rgb ); // red cube
237  outCubeMesh->info() = Dtk_Info::Create();
238  outCubeMesh->info()->SetColor( rgb );
239 
240  return outCubeMesh;
241  }

◆ CreateMeshCubeVertexColor()

Dtk_MeshPtr sampleWriter::CreateMeshCubeVertexColor ( )

Creates a unit cube mesh with per-vertex color data (red, green, blue, white cycling per face).

Creates a unit cube mesh with per-vertex color data.

301  {
302  // Variables
303  Dtk_tab<Dtk_pnt> vertices;
304  Dtk_tab<Dtk_dir> normals;
305  Dtk_tab<Dtk_Float32> uCoords;
306  Dtk_tab<Dtk_Float32> vCoords;
307  Dtk_RGB red( 255, 0, 0 );
308  Dtk_RGB green( 0, 255, 0 );
309  Dtk_RGB blue( 0, 0, 255 );
310  Dtk_RGB all( 255, 255, 255 );
311 
312  // Our mesh
313  Dtk_mesh* outCubeMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_RGB ); // coords & normals & vertex colors
314 
315  // PART1 : CREATING GEOMETRY ARRAYS (HARD CODED here)
316  CreateMeshCubeGeometry( vertices, normals, uCoords, vCoords );
317 
318  // PART2 : STORING geometry (vertices & normals & vertex color) into the mesh
319 
320  for( Dtk_Size_t i = 0; i < vertices.size(); i += 4 )
321  {
322 
323  outCubeMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), &red );
324  outCubeMesh->add_vertex( &( vertices.at( i + 1 ) ), &( normals.at( i + 1 ) ), &green );
325  outCubeMesh->add_vertex( &( vertices.at( i + 2 ) ), &( normals.at( i + 2 ) ), &blue );
326  outCubeMesh->add_vertex( &( vertices.at( i + 3 ) ), &( normals.at( i + 3 ) ), &all );
327  }
328 
329  // At this point, vertices & normals are stored, but we have no faces yet
330 
331  // PART3 : BUILDING THE SIX FACES
332  CreateMeshCubeFaces( outCubeMesh );
333 
334  return outCubeMesh;
335  }

◆ CreateMeshCuboid()

Dtk_MeshPtr sampleWriter::CreateMeshCuboid ( const Dtk_pnt &  inFirstPoint,
const Dtk_pnt &  inSecondPoint 
)

Creates an axis-aligned cuboid mesh from two opposite corner points.

Creates a cuboid (axis-aligned box) mesh from two opposite corner points.

461  {
462  // Variables
463  Dtk_tab<Dtk_pnt> vertices;
464  Dtk_tab<Dtk_dir> normals;
465  Dtk_tab<Dtk_UInt32> indices;
466  Dtk_tab<Dtk_Float32> uCoords;
467  Dtk_tab<Dtk_Float32> vCoords;
468 
469  // Our mesh
470  Dtk_mesh* outCuboidMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UV_TEXTURES /*if you have materials*/ ); // coords & normals & materials
471 
473  inPoints.first = inFirstPoint;
474  inPoints.second = inSecondPoint;
475 
476  // PART1 : CREATING GEOMETRY AND UV COORDINATES ARRAYS (HARD CODED here)
477  CreateMeshCubeidGeometry( vertices, normals, uCoords, vCoords, inPoints );
478 
479  // PART2 : STORING geometry (vertices & normals) into the mesh
480 
481  for( Dtk_Size_t i = 0; i < vertices.size(); i++ )
482  {
483  outCuboidMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), NULL, uCoords[ i ], vCoords[ i ] );
484  }
485 
486  // At this point, vertices & normals are stored, but we have no faces yet
487 
488  // PART3 : BUILDING THE SIX FACES
489  CreateMeshCubeFaces( outCuboidMesh );
490 
491  Dtk_RGB rgb( 255, 0, 0 );
492  outCuboidMesh->set_mesh_color( rgb ); // red cube
493  outCuboidMesh->info() = Dtk_Info::Create();
494  outCuboidMesh->info()->SetColor( rgb );
495 
496  return outCuboidMesh;
497  }

◆ CreateMeshCylinder()

Dtk_MeshPtr sampleWriter::CreateMeshCylinder ( int  nbpoints)

Mesh Cylinder sample.

Creates a cylinder mesh with circular caps and lateral surface, tessellated with the given number of circle points.

339  {
340  // Variables
341  Dtk_mesh_face* face = NULL;
342  Dtk_tab<Dtk_pnt> vertices;
343  Dtk_tab<Dtk_dir> normals;
344  Dtk_tab<Dtk_UInt32> indices;
345 
346  if( nbpoints < 3 )
347  {
348  return NULL;
349  }
350 
351  // Our mesh
352  Dtk_mesh* outCylinderMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL ); // coords & normals
353 
354  Dtk_Size_t i;
355  double radius = 3;
356  double height = 5;
357  for( i = 0; i < ( Dtk_Size_t )nbpoints; i++ )
358  {
359  double angle = i * 2 * DTK_PI / nbpoints;
360  normals.push_back( Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
361  vertices.push_back( radius * Dtk_pnt( cos( angle ), sin( angle ) ) + Dtk_pnt( 0, 0, height ) );
362  normals.push_back( Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
363  vertices.push_back( radius * Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
364  indices.push_back( ( Dtk_UInt32 )indices.size() );
365  indices.push_back( ( Dtk_UInt32 )indices.size() );
366  }
367  indices.push_back( 0 );
368  indices.push_back( 1 );
369 
370  face = new Dtk_mesh_face( outCylinderMesh );
371  face->add_triangle_strip( &indices, &vertices, &normals );
372  outCylinderMesh->add_mesh_face( face );
373 
374  Dtk_RGB rgb( 255, 255, 0, 128 );
375  outCylinderMesh->set_mesh_color( rgb ); // yellow transparent cylinder
376  outCylinderMesh->info() = Dtk_Info::Create();
377  outCylinderMesh->info()->SetColor( rgb );
378 
379 
380  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mymesh", L"Value of mymesh" );
381  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
382  ArrayMetadataEntity.push_back( metadata );
383  outCylinderMesh->info()->SetMetaData( ArrayMetadataEntity );
384 
385  return outCylinderMesh;
386  }

◆ CreateMeshPoints()

Dtk_MeshPtr sampleWriter::CreateMeshPoints ( )

Points mesh sample.

Creates a point cloud mesh.

441  {
442  Dtk_mesh* outPointMesh = new Dtk_mesh( DTK_MESH_XYZ ); // coords
443  outPointMesh->info() = Dtk_Info::Create();
444  outPointMesh->info()->SetColor( Dtk_RGB( 255, 100, 0 ) );
445  Dtk_mesh_face* face = new Dtk_mesh_face( outPointMesh );
446  double coords[ 8 ][ 3 ] = { {-1,-1,-1},{-1,-1,1},{-1,1,-1},{-1,1,1},
447  {1,-1,-1},{1,-1,1},{1,1,-1},{1,1,1} };
448  int i;
449  for( i = 0; i < 8; i++ )
450  {
451  Dtk_pnt P( coords[ i ][ 0 ], coords[ i ][ 1 ], coords[ i ][ 2 ] );
452  outPointMesh->add_vertex( &P );
453  face->add_point( i );
454  }
455  outPointMesh->add_mesh_face( face );
456  return outPointMesh;
457  }

◆ CreateMeshWire()

Dtk_MeshPtr sampleWriter::CreateMeshWire ( )

Wire mesh sample.

Creates a wireframe (polyline) mesh.

390  {
391  // Variables
392  Dtk_mesh_face* face = NULL;
393  Dtk_tab<Dtk_pnt> vertices;
394  Dtk_tab<Dtk_dir> normals;
395  Dtk_tab<Dtk_UInt32> indices;
396  Dtk_Size_t i, numVertices;
397  Dtk_InfoPtr info = NULL;
398 
399  // Our mesh
400  Dtk_mesh* outWireMesh = new Dtk_mesh( DTK_MESH_XYZ ); // coords
401 
402  face = new Dtk_mesh_face( outWireMesh );
403 
404  //free curves
405  vertices.push_back( Dtk_pnt( -1.0f, 1.0f, 1.0f ) ); //0.,1.,0.
406  vertices.push_back( Dtk_pnt( -1.0f, 1.0f, -1.0f ) );
407  vertices.push_back( Dtk_pnt( 1.0f, 1.0f, -1.0f ) );
408  vertices.push_back( Dtk_pnt( 1.0f, 1.0f, 1.0f ) );
409 
410  numVertices = vertices.size();
411  for( i = 0; i < numVertices; i++ )
412  {
413  indices.push_back( ( Dtk_UInt32 )i );
414  }
415  indices.push_back( 0 );
416 
417  info = Dtk_Info::Create();
418  info->SetColor( Dtk_RGB( 0, 0, 255 ) );
419  face->add_polyline( &indices, &vertices );
420  face->add_subinfo( info );
421  outWireMesh->add_mesh_face( face );
422 
423  //free vertex
424  info = NULL;
425  info = Dtk_Info::Create();
426  vertices.clear();
427  indices.clear();
428  face = new Dtk_mesh_face( outWireMesh );
429  vertices.push_back( Dtk_pnt( 0.0f, 1.0f, 0.0f ) );
430  indices.push_back( 0 );
431  info->SetColor( Dtk_RGB( 255, 0, 0 ) );
432  face->add_points( &indices, &vertices );
433  face->add_subinfo( info );
434  outWireMesh->add_mesh_face( face );
435 
436  return outWireMesh;
437  }

◆ CreateMixedBody()

Dtk_BodyPtr sampleWriter::CreateMixedBody ( )

Creates a mixed body combining a closed BRep cube (solid) with additional free surfaces and wireframe curves in the same body.

Creates a body combining both BRep faces and wireframe curves in a single body.

1837  {
1838  Dtk_BodyPtr body = CreateCube();
1839 
1840  Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( -20.0, -20.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1841  Dtk_Double64 domain[] = { 0.0,6.0,0.0,100.0 };
1842  cyl->SetTrimUVBox( domain );
1843  cyl->info() = Dtk_Info::Create();
1844  cyl->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1845  body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
1846 
1847 
1848  cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( -20.0, 20.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1849  Dtk_Double64 domain2[] = { 0.0,3.14,-50.0,50.0 };
1850  cyl->SetTrimUVBox( domain2 );
1851  cyl->info() = Dtk_Info::Create();
1852  cyl->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
1853  body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
1854 
1855  return body;
1856  }

◆ CreateModelDisplayActivated()

Dtk_ModelDisplayPtr sampleWriter::CreateModelDisplayActivated ( )

Creates an activated (visible) model display "MyView1" with a perspective camera.

Creates an activated model display (visible view state).

322  {
323  Dtk_ModelDisplayPtr resMD;
324  Dtk_pnt from = Dtk_pnt( 300, 300, 300 );
325  Dtk_pnt to( 0, 0, 0 );
326  Dtk_pnt up = Dtk_dir( -0.57735, 0.57735, -0.57735 );
327  Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 250, 250, up );
328  resMD = Dtk_ModelDisplay::Create( cam, NULL, DTK_TRUE );// create activated model display
329  resMD->info() = Dtk_Info::Create();
330  resMD->info()->SetName( "MyView1" );
331  return resMD;
332  }

◆ CreateModelDisplayDesactivated()

Dtk_ModelDisplayPtr sampleWriter::CreateModelDisplayDesactivated ( )

Creates a deactivated (hidden) model display "MyView2" with an orthographic camera.

Creates a deactivated model display (hidden view state with section).

336  {
337  Dtk_ModelDisplayPtr resMD;
338  Dtk_pnt from( 0, 0, 100 );
339  Dtk_pnt to( 0, 0, 0 );
340  Dtk_dir up( 0, 1, 0 );
341  Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 100, 100, up ); // semiwidth = 100
342  resMD = Dtk_ModelDisplay::Create( cam, NULL, DTK_FALSE ); // create desactivated model display
343  resMD->info() = Dtk_Info::Create();
344  resMD->info()->SetName( "MyView2" );
345  return resMD;
346  }

◆ CreateModelDisplayWithSection()

Dtk_ModelDisplayPtr sampleWriter::CreateModelDisplayWithSection ( )

Creates a deactivated model display "MySectionView" with a section cut plane applied.

Creates a model display with an active section cut plane.

350  {
351  Dtk_ModelDisplayPtr resMD;
352  Dtk_PlaneSurfacePtr section = Dtk_PlaneSurface::Create( Dtk_pnt(), Dtk_dir( 0.75, -0.4, 0. ), Dtk_dir( 0., 0., 1. ) );
354  resMD = Dtk_ModelDisplay::Create( mv1->GetCamera(), Dtk_EntityPtr::DtkDynamicCast( section ), DTK_FALSE ); // create second desactivated view with section
355  resMD->info() = Dtk_Info::Create();
356  resMD->info()->SetName( "MySectionView" );
357 
358  return resMD;
359  }

◆ CreateOpenShell()

Dtk_BodyPtr sampleWriter::CreateOpenShell ( )

Creates an open shell body containing a single trimmed cylindrical surface (half cylinder, not closed).

Creates an open shell body (a trimmed cylindrical surface).

1354  {
1355  Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
1356  Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1357  Dtk_Double64 domain[] = { 0.0,3.14,-5.0,5.0 };
1358  cyl->SetTrimUVBox( domain );
1359  body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
1360 
1361  //For an open shell you can also create an OpenShell and call
1362  //body->AddOpenShell(shell);
1363 
1364  return body;
1365  }

◆ CreateOpenShell_2()

Dtk_BodyPtr sampleWriter::CreateOpenShell_2 ( )

Creates an open shell body (trimmed cylindrical surface) augmented with open-shell attributes.

Creates an open shell body (5 faces) augmented with open-shell validation properties.

1096  {
1097  Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
1098  Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
1099  Dtk_Double64 domain[] = { 0.0,3.14,-5.0,5.0 };
1100  cyl->SetTrimUVBox( domain );
1101  body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
1102 
1103  //For an open shell you can also create an OpenShell and call
1104  //body->AddOpenShell(shell);
1105 
1106  return body;
1107  }

◆ CreatePoint()

Dtk_BodyPtr sampleWriter::CreatePoint ( )

Creates a wireframe body containing a single named red point with metadata.

Creates a wireframe body containing a single named point with color and metadata.

1484  {
1485  Dtk_tab<Dtk_PointPtr> mypoints;
1486  Dtk_BodyPtr mybody;
1487  mybody = Dtk_Body::Create();
1488 
1489  Dtk_ShellPtr myshell;
1490  myshell = Dtk_Shell::Create( mybody );
1491 
1492  Dtk_PointPtr mypoint;
1493  mypoint = Dtk_Point::Create( Dtk_pnt( -10.0, 11.0, 12.0 ) );
1494  mypoint->info() = Dtk_Info::Create();
1495  mypoint->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
1496  mypoint->info()->SetName( "mypoint" );
1497 
1498  Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mypoint", L"Value of mypoint" );
1499  Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
1500  ArrayMetadataEntity.push_back( metadata );
1501  mypoint->info()->SetMetaData( ArrayMetadataEntity );
1502 
1503  mypoints.push_back( mypoint );
1504 
1505  myshell->AddWire( mypoints );
1506  mybody->AddWireShell( myshell );
1507  return mybody;
1508  }

◆ CreateTexturedMeshCube()

Dtk_MeshPtr sampleWriter::CreateTexturedMeshCube ( const Dtk_string &  inImageDirectory)

Textured Mesh Cube sample.

Creates a unit cube mesh with UV texture coordinates, referencing an image from the given directory.

273  {
274  // Our mesh
275  Dtk_MeshPtr outCubeMesh = CreateMeshCube();
276 
277  // create mesh texture with cubical mapping
278  Dtk_RenderInfosPtr meshRender = Dtk_RenderInfos::Create( "meshRender" );
280  meshTexture->SetImagePath( inImageDirectory + "sample.bmp" );
281  meshTexture->SetScale( 2., 2. ); // image scale
282  meshRender->SetTexture( meshTexture );
283  outCubeMesh->info()->AddRenderInfos( meshRender ); // apply texture to mesh
284  outCubeMesh->info()->SetName( "TexturedMesh" );
285 
286  // create face render texture
287  Dtk_RenderInfosPtr faceRender = Dtk_RenderInfos::Create( "faceRender" );
289  faceTexture->SetImagePath( inImageDirectory + "logodtk.bmp" );
290  faceTexture->SetScale( 2., 2. ); // image scale
291  faceRender->SetTexture( faceTexture );
292  if( outCubeMesh->get_mesh_face( 2 )->info().IsNULL() )
293  outCubeMesh->get_mesh_face( 2 )->info() = Dtk_Info::Create();
294  outCubeMesh->get_mesh_face( 2 )->info()->AddRenderInfos( faceRender ); // apply texture to face
295 
296  return outCubeMesh;
297  }

◆ FillFacesColors()

void sampleWriter::FillFacesColors ( Dtk_MeshPtr &  inoutCubeMesh)

Filling mesh faces with colors.

Applies distinct per-face colors to an existing cube mesh (modifies the mesh in place).

245  {
246  Dtk_InfoPtr infoFace0 = Dtk_Info::Create();
247  infoFace0->SetColor( Dtk_RGB( 255, 1, 0 ) );
248  inoutCubeMesh->get_mesh_face( 0 )->info() = infoFace0;
249 
250  Dtk_InfoPtr infoFace1 = Dtk_Info::Create();
251  infoFace1->SetColor( Dtk_RGB( 0, 255, 0 ) );
252  inoutCubeMesh->get_mesh_face( 1 )->info() = infoFace1;
253 
254  Dtk_InfoPtr infoFace2 = Dtk_Info::Create();
255  infoFace2->SetColor( Dtk_RGB( 0, 0, 255 ) );
256  inoutCubeMesh->get_mesh_face( 2 )->info() = infoFace2;
257 
258  Dtk_InfoPtr infoFace3 = Dtk_Info::Create();
259  infoFace3->SetColor( Dtk_RGB( 255, 255, 0 ) );
260  inoutCubeMesh->get_mesh_face( 3 )->info() = infoFace3;
261 
262  Dtk_InfoPtr infoFace4 = Dtk_Info::Create();
263  infoFace4->SetColor( Dtk_RGB( 0, 255, 255 ) );
264  inoutCubeMesh->get_mesh_face( 4 )->info() = infoFace4;
265 
266  Dtk_InfoPtr infoFace5 = Dtk_Info::Create();
267  infoFace5->SetColor( Dtk_RGB( 255, 128, 0 ) );
268  inoutCubeMesh->get_mesh_face( 5 )->info() = infoFace5;
269  }
sampleWriter::Coedge0_DC
@ Coedge0_DC
Definition: testcreatecube.cpp:45
Dtk_Info::Create
static Dtk_SmartPtr< Dtk_Info > Create()
Calls default constructor to allocate a new object.
sampleWriter::Coedge3_HC
@ Coedge3_HC
Definition: testcreatecube.cpp:59
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_ToleranceSpecification::Create
static Dtk_ToleranceSpecificationPtr Create()
Calls default constructor to allocate a new object.
sampleWriter::Loop5_EHCA
@ Loop5_EHCA
Definition: testcreatecube.cpp:70
Dtk_pair
Definition: util_stl_dtk.hpp:921
DTK_MESH_NORMAL
#define DTK_MESH_NORMAL
Definition: util_mesh_dtk.hpp:31
sampleWriter::Edge_GD
@ Edge_GD
Definition: testcreatecube.cpp:36
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_RGB::SetRGBA
void SetRGBA(const int &inRed, const int &inGreen, const int &inBlue, const int &inAlpha=-1)
Definition: dtk_rgb.hpp:51
Dtk_TextureInfos::Create
static Dtk_TextureInfosPtr Create(const TextureMappingTypeEnum &inType)
Create a Dtk_TextureInfosPtr.
sampleWriter::Coedge3_GD
@ Coedge3_GD
Definition: testcreatecube.cpp:55
Dtk_Info::AddAttribute
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
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::Vertex_A
@ Vertex_A
Definition: testcreatecube.cpp:21
Dtk_Info::SetName
Dtk_ErrorStatus SetName(Dtk_string inName)
sampleWriter::Edge_FB
@ Edge_FB
Definition: testcreatecube.cpp:34
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:207
Dtk_TextStyle
This is the text_style. This class gathers information about text style.
Definition: util_draw_dtk.hpp:242
sampleWriter::Coedge5_CA
@ Coedge5_CA
Definition: testcreatecube.cpp:44
Dtk_transfo::setOrigin
void setOrigin(const Dtk_pnt &O)
Set a new O center point.
Dtk_transfo::setZdir
void setZdir(const Dtk_dir &Z)
Set a new Z vector.
sampleWriter::Shell
@ Shell
Definition: testcreatecube.cpp:20
sampleWriter::Edge_FE
@ Edge_FE
Definition: testcreatecube.cpp:35
Dtk_Loop::Create
static Dtk_LoopPtr Create(const Dtk_BodyPtr &inParentBody)
Create a loop in a body.
sampleWriter::Coedge4_HG
@ Coedge4_HG
Definition: testcreatecube.cpp:62
sampleWriter::Coedge5_EH
@ Coedge5_EH
Definition: testcreatecube.cpp:64
DTK_TRUE
#define DTK_TRUE
Definition: define.h:726
Dtk_ToleranceSpecificationContainer::Create
static Dtk_ToleranceSpecificationContainerPtr Create(const Dtk_ToleranceSpecificationContainer &in)
Calls copy constructor to allocate a new object.
dtk_text_type_value
@ dtk_text_type_value
Definition: str_def.h:14
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:687
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
DTK_ANCHOR_BOTTOM_LEFT
@ DTK_ANCHOR_BOTTOM_LEFT
Definition: util_draw_dtk.hpp:99
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:711
sampleWriter::Volume
@ Volume
Definition: testcreatecube.cpp:19
sampleWriter::Coedge4_GF
@ Coedge4_GF
Definition: testcreatecube.cpp:58
Dtk_mesh_face::add_triangle_strip
int add_triangle_strip(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle strip.
sampleWriter::Edge_BD
@ Edge_BD
Definition: testcreatecube.cpp:32
Dtk_Text
This is the base text class. It's part of Dtk_CompositeText. This class represents the texts and valu...
Definition: util_draw_dtk.hpp:1041
sampleWriter::Edge_HC
@ Edge_HC
Definition: testcreatecube.cpp:38
Dtk_RenderInfos::Create
static Dtk_RenderInfosPtr Create(const Dtk_string &inName)
Creates a Dtk_RenderInfosPtr.
Dtk_Info::SetMetaData
Dtk_ErrorStatus SetMetaData(Dtk_tab< Dtk_MetaDataPtr > &inArray)
sampleWriter::Coedge5_EA
@ Coedge5_EA
Definition: testcreatecube.cpp:50
sampleWriter::Coedge3_HG
@ Coedge3_HG
Definition: testcreatecube.cpp:61
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_FALSE
#define DTK_FALSE
Definition: define.h:727
Dtk_Face::AddOuterLoop
Dtk_ErrorStatus AddOuterLoop(const Dtk_LoopPtr &inLoop)
Add outer loop on a face.
sampleWriter::Edge_CA
@ Edge_CA
Definition: testcreatecube.cpp:30
sampleWriter::Coedge0_BD
@ Coedge0_BD
Definition: testcreatecube.cpp:47
Dtk_bool
char Dtk_bool
Definition: define.h:724
Dtk_TextStyle::Slant
Dtk_Double64 & Slant()
Retrieves the text slant - get/set -.
Dtk_mesh::add_vertex
int add_vertex(const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.)
Add a vertex to the mesh vertices list.
Dtk_RenderInfos::SetTexture
void SetTexture(const Dtk_TextureInfosPtr &inTexture)
Sets the render texture information.
Dtk_Symbol::Create
static Dtk_SymbolPtr Create()
Calls default constructor to allocate a new object.
DTK_MESH_UV_TEXTURES
#define DTK_MESH_UV_TEXTURES
Definition: util_mesh_dtk.hpp:33
DTK_ANCHOR_MIDDLE_CENTER
@ DTK_ANCHOR_MIDDLE_CENTER
Definition: util_draw_dtk.hpp:97
sampleWriter::Coedge2_GF
@ Coedge2_GF
Definition: testcreatecube.cpp:57
sampleWriter::Edge_EH
@ Edge_EH
Definition: testcreatecube.cpp:40
Dtk_Double64
double Dtk_Double64
Definition: define.h:698
sampleWriter::Vertex_H
@ Vertex_H
Definition: testcreatecube.cpp:28
Dtk_transfo::setXdir
void setXdir(const Dtk_dir &X)
Set a new X vector.
sampleWriter::Coedge2_FB
@ Coedge2_FB
Definition: testcreatecube.cpp:52
Dtk_mesh
This is a high level mesh class.
Definition: util_mesh_dtk.hpp:694
Dtk_Dimension::DistanceDimension
@ DistanceDimension
Definition: util_draw_dtk.hpp:4553
Dtk_pair::first
T1 first
Definition: util_stl_dtk.hpp:923
Dtk_TextStyle::CharWidth
Dtk_Double64 & CharWidth()
Retrieves the char width - get/set -.
sampleWriter::FaceABCD
@ FaceABCD
Definition: testcreatecube.cpp:71
Dtk_Val
Definition: dtk_val.hpp:67
Dtk_mesh_face::add_subinfo
int add_subinfo(Dtk_InfoPtr &ininf)
Dtk_Face::Create
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
sampleWriter::Vertex_G
@ Vertex_G
Definition: testcreatecube.cpp:27
sampleWriter::Coedge4_FE
@ Coedge4_FE
Definition: testcreatecube.cpp:56
DTK_MESH_RGB
#define DTK_MESH_RGB
Definition: util_mesh_dtk.hpp:32
DTK_DASHED
@ DTK_DASHED
Definition: util_ent_dtk.hpp:51
sampleWriter::Loop0_ABCD
@ Loop0_ABCD
Definition: testcreatecube.cpp:65
sampleWriter::FaceABFE
@ FaceABFE
Definition: testcreatecube.cpp:72
Dtk_ReferenceBlock::Create
static Dtk_ReferenceBlockPtr Create(const Dtk_Oriented2dBBox &inInnerBBox, const Dtk_Oriented2dBBox &inOuterBBox)
Calls full featured constructor to allocate a new object.
sampleWriter::FaceGDCH
@ FaceGDCH
Definition: testcreatecube.cpp:74
sampleWriter::Coedge3_DC
@ Coedge3_DC
Definition: testcreatecube.cpp:46
sampleWriter::Vertex_B
@ Vertex_B
Definition: testcreatecube.cpp:22
sampleWriter::FaceEFGH
@ FaceEFGH
Definition: testcreatecube.cpp:75
Dtk_ReferenceFrame::Create
static Dtk_ReferenceFramePtr Create()
Calls default constructor to allocate a new object.
Dtk_AxisSystem::Create
static Dtk_SmartPtr< Dtk_AxisSystem > Create()
Calls default constructor to allocate a new object.
sampleWriter::Edge_EA
@ Edge_EA
Definition: testcreatecube.cpp:33
sampleWriter::Edge_AB
@ Edge_AB
Definition: testcreatecube.cpp:29
Dtk_anchor_type
Dtk_anchor_type
Definition: util_draw_dtk.hpp:92
sampleWriter::Edge_GF
@ Edge_GF
Definition: testcreatecube.cpp:37
DTK_Text_type
DTK_Text_type
Definition: str_def.h:11
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
Dtk_tab::resize
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
DTK_DOTTED
@ DTK_DOTTED
Definition: util_ent_dtk.hpp:57
Dtk_Symbol::TypeDatum
@ TypeDatum
Definition: util_draw_dtk.hpp:5987
sampleWriter::Coedge2_GD
@ Coedge2_GD
Definition: testcreatecube.cpp:54
sampleWriter::Loop1_ABFE
@ Loop1_ABFE
Definition: testcreatecube.cpp:66
Dtk_Dimension::Create
static Dtk_DimensionPtr Create()
Calls default constructor to allocate a new object.
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:29
Dtk_Dimension::DimensionTypeEnum
DimensionTypeEnum
Definition: util_draw_dtk.hpp:4533
Dtk_Lump::Create
static Dtk_LumpPtr Create(const Dtk_BodyPtr &inParentBody)
Create a lump in a body.
sampleWriter::Vertex_D
@ Vertex_D
Definition: testcreatecube.cpp:24
Dtk_mesh_face::add_point
int add_point(Dtk_UInt32 inpnt)
Dtk_pair::second
T2 second
Definition: util_stl_dtk.hpp:924
Dtk_SmartPtr::DtkDynamicCast
static Dtk_SmartPtr< T > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_mesh::set_mesh_color
void set_mesh_color(const Dtk_RGB &inColor)
set color in Dtk_mesh
sampleWriter::Coedge1_FB
@ Coedge1_FB
Definition: testcreatecube.cpp:51
sampleWriter::Vertex_C
@ Vertex_C
Definition: testcreatecube.cpp:23
Dtk_SmartPtr::IsNULL
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Dtk_Fdt::Create
static Dtk_FdtPtr Create()
Calls default constructor to allocate a new object.
Dtk_Face::SetGeom
void SetGeom(const Dtk_SurfacePtr &inSurface)
Set Geometry.
Dtk_NurbsCurve::Create
static Dtk_NurbsCurvePtr Create(const Dtk_NurbsCurve &in)
Calls copy constructor to allocate a new object.
Dtk_transfo::setScale
void setScale(Dtk_Double64 scale)
Set a new scale.
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Dtk_Edge::Create
static Dtk_EdgePtr Create(const Dtk_BodyPtr &inParentBody)
Create an edge in a body.
sampleWriter::FaceFBDG
@ FaceFBDG
Definition: testcreatecube.cpp:73
sampleWriter::Lump
@ Lump
Definition: testcreatecube.cpp:18
Dtk_Point::Create
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
sampleWriter::Coedge1_EA
@ Coedge1_EA
Definition: testcreatecube.cpp:49
Dtk_transfo::setYdir
void setYdir(const Dtk_dir &Y)
Set a new Y vector.
dtk_text_type_modifier
@ dtk_text_type_modifier
Definition: str_def.h:21
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
sampleWriter::Coedge4_EH
@ Coedge4_EH
Definition: testcreatecube.cpp:63
Dtk_CompositeText
This is the composite text class. It's basically a Dtk_Text Container. This class represents a group ...
Definition: util_draw_dtk.hpp:1445
sampleWriter::Coedge2_BD
@ Coedge2_BD
Definition: testcreatecube.cpp:48
Dtk_Leader::Create
static Dtk_LeaderPtr Create()
Calls default constructor to allocate a new object.
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Calls default constructor to allocate a new object.
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Creates an activated (visible) model display "MyView1" with a perspective camera.
Definition: testcreatefdt.cpp:321
Dtk_Leader::TerminatorTypeClosedArrow
@ TerminatorTypeClosedArrow
Definition: util_draw_dtk.hpp:1858
Dtk_Line::Create
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
Dtk_TextStyle::CharHeight
Dtk_Double64 & CharHeight()
Retrieves the char height - get/set -.
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Dtk_Vertex::Create
static Dtk_VertexPtr Create(const Dtk_BodyPtr &inParentBody)
Create a vertex in a body.
Dtk_Coedge::Create
static Dtk_CoedgePtr Create(const Dtk_BodyPtr &inParentBody)
Create a coedge in a body.
sampleWriter::CreateCube
Dtk_BodyPtr CreateCube()
Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex,...
Definition: testcreatecube.cpp:1325
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
sampleWriter::FaceEHCA
@ FaceEHCA
Definition: testcreatecube.cpp:76
sampleWriter::Vertex_F
@ Vertex_F
Definition: testcreatecube.cpp:26
sampleWriter::Coedge5_HC
@ Coedge5_HC
Definition: testcreatecube.cpp:60
sampleWriter::Coedge1_AB
@ Coedge1_AB
Definition: testcreatecube.cpp:42
sampleWriter::Coedge0_AB
@ Coedge0_AB
Definition: testcreatecube.cpp:41
Dtk_Leader::LeaderTerminatorTypeEnum
LeaderTerminatorTypeEnum
Internal leader terminator type.
Definition: util_draw_dtk.hpp:1852
Dtk_tab::at
T & at(Dtk_Size_t k)
Definition: util_stl_dtk.hpp:397
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_FRAME_TYPE_RECTANGLE
@ DTK_FRAME_TYPE_RECTANGLE
Definition: util_draw_dtk.hpp:129
sampleWriter::Coedge0_CA
@ Coedge0_CA
Definition: testcreatecube.cpp:43
Dtk_GeometricalTolerance::Create
static Dtk_GeometricalTolerancePtr Create()
Calls default constructor to allocate a new object.
Dtk_tab::clear
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:352
Dtk_CompositeText::AddText
void AddText(Dtk_Text inText)
Adds a Dtk_Text to the Dtk_CompositeText.
sampleWriter::Edge_DC
@ Edge_DC
Definition: testcreatecube.cpp:31
Dtk_TextureInfos::CubicalMapping
@ CubicalMapping
Definition: dtk_render.hpp:39
Dtk_Ellipse::Create
static Dtk_EllipsePtr Create(const Dtk_Ellipse &in)
Calls copy constructor to allocate a new object.
Dtk_RGB
Definition: dtk_rgb.hpp:8
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
Dtk_Oriented2dBBox
This is the base bounding box class. It's used into a lot of 2D Entities This class represents the ba...
Definition: util_draw_dtk.hpp:450
sampleWriter::Coedge1_FE
@ Coedge1_FE
Definition: testcreatecube.cpp:53
Dtk_Polyline::Create
static Dtk_PolylinePtr Create(const Dtk_Polyline &in)
Calls copy constructor to allocate a new object.
Dtk_mesh::add_mesh_face
int add_mesh_face(Dtk_mesh_face *inMesh_face)
Add a face (Dtk_mesh_face) to the mesh.
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
Dtk_Oriented2dBBox::Extend
void Extend(const Dtk_Double64 &inXExtend, const Dtk_Double64 &inYExtend)
Extend the bounding box.
Dtk_mesh_face::add_polyline
int add_polyline(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polyline.
Dtk_mesh_face::add_points
int add_points(const Dtk_tab< Dtk_UInt32 > *pnts)
sampleWriter::Vertex_E
@ Vertex_E
Definition: testcreatecube.cpp:25
Dtk_Volume::Create
static Dtk_VolumePtr Create(const Dtk_BodyPtr &inParentBody)
Create a volume in a body.
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_ToleranceSpecificationContainer::TypePosition
@ TypePosition
Definition: util_draw_dtk.hpp:5719
DTK_PI
#define DTK_PI
Definition: str_def.h:8
sampleWriter::Loop3_GDCH
@ Loop3_GDCH
Definition: testcreatecube.cpp:68
Dtk_Entity::info
Dtk_InfoPtr & info()
sampleWriter::Loop4_EFGH
@ Loop4_EFGH
Definition: testcreatecube.cpp:69
sampleWriter::Loop2_FBDG
@ Loop2_FBDG
Definition: testcreatecube.cpp:67
sampleWriter::Edge_HG
@ Edge_HG
Definition: testcreatecube.cpp:39
Dtk_CylindricalSurface::Create
static Dtk_CylindricalSurfacePtr Create(const Dtk_pnt &inOrigin, const Dtk_dir &inNormal, const Dtk_dir &inUDirection, const Dtk_Double64 &inRadius, const Dtk_dir &inYDirection=Dtk_dir())
Create an infinite cylinder.