DATAKIT SDK  V2026.2
stepw::sample Namespace Reference

Set of sample functions to write specific data into a .stp file. More...

Functions

Dtk_AxisSystemPtr CreateAxisSystem ()
 
void CreateTransforms (Dtk_transfo &outFirst, Dtk_transfo &outSecond, Dtk_transfo &outThird)
 
DtkErrorStatus Write_MinimumViableFile (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus Write_UserDefinedHeader (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WriteAssembly (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_BasicExternalReference_DimensionFDT (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_BasicExternalReferences (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_DimensionFDT (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_InstanceAttributes (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_NestedExternalReferences (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WriteAssembly_WithProperties (const Dtk_string &inRootAssemblyName)
 
DtkErrorStatus WritePart_BodyAndMeshFromTessellation (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_BodyInNamedLayer (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_BodyOnly (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_BodyWithAxisSystem (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_Datum (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_GeometricalTolerance (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_MeshOnly (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_MeshWithFaceColors (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_UsedByExternalAssembly (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_WireframeOnly (const Dtk_string &inPartName, int &outPartID)
 
DtkErrorStatus WritePart_WithProperties (const Dtk_string &inPartName, int &outPartID)
 

Detailed Description

Set of sample functions to write specific data into a .stp file.

Function Documentation

◆ CreateAxisSystem()

Dtk_AxisSystemPtr stepw::sample::CreateAxisSystem ( )
21  {
23  Dtk_transfo trsf;
24  trsf.setOrigin( Dtk_pnt( 100., 100., 100. ) );
25  axis->SetMatrix( trsf );
26  axis->SetName( "Axis_System" );
27  return axis;
28  }

◆ CreateTransforms()

void stepw::sample::CreateTransforms ( Dtk_transfo outFirst,
Dtk_transfo outSecond,
Dtk_transfo outThird 
)
31  {
32  outFirst = Dtk_transfo();
33  outSecond = Dtk_transfo();
34  outThird = Dtk_transfo();
35  outSecond.setOrigin( Dtk_pnt( 0., 150., -150. ) );
36  outThird.setOrigin( Dtk_pnt( 0., -150., -150. ) );
37  }

◆ Write_MinimumViableFile()

DtkErrorStatus stepw::sample::Write_MinimumViableFile ( const Dtk_string inPartName,
int &  outPartID 
)
42  {
43  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
44  PRINT_ERROR( stepw_Init3DPart( outPartID ) );
46  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
47  return dtkNoError;
48  }

◆ Write_UserDefinedHeader()

DtkErrorStatus stepw::sample::Write_UserDefinedHeader ( const Dtk_string inPartName,
int &  outPartID 
)
53  {
54  PRINT_ERROR( stepw_SetHeaderData( 0, L"This is the file description" ) );
55  PRINT_ERROR( stepw_SetHeaderData( 1, L"This is the author" ) );
56  PRINT_ERROR( stepw_SetHeaderData( 2, L"This is the organization writing the file" ) );
57  PRINT_ERROR( stepw_SetHeaderData( 3, L"This is the originating system" ) );
58  PRINT_ERROR( stepw_SetHeaderData( 4, L"This is the authorization" ) );
59 
60  return Write_MinimumViableFile( inPartName, outPartID );
61  }

◆ WriteAssembly()

DtkErrorStatus stepw::sample::WriteAssembly ( const Dtk_string inRootAssemblyName)
380  {
381  Dtk_transfo trf0, trf1, trf2;
382  CreateTransforms( trf0, trf1, trf2 );
383 
384  int assignedID_leafPart = 0;
385  PRINT_ERROR( WritePart_BodyOnly( L"PartWithBody", assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
386 
387  int assignedID_subProduct = 0;
388  {//Creates sub-product
389  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
390 
391  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "PartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
392 
393  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
394  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
395 
396  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
397  }
398  {//Creates root product
399  int assignedID_rootProduct = 0;
400  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
401 
402  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
403  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
404  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct" ) );//Adds an instance of leaf product in root product
405 
406  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
407  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
408 
409  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
410  }
411 
412  return dtkNoError;
413  }

◆ WriteAssembly_BasicExternalReference_DimensionFDT()

DtkErrorStatus stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT ( const Dtk_string inRootAssemblyName)
682  {
683  Dtk_transfo trf0, trf1, trf2;
684  CreateTransforms( trf0, trf1, trf2 );
685 
686  int assignedID_leafPart;
687  Dtk_string uniqueNameForLeafProduct = L"ExternalPartWithBody_ReferencedByFDT";//Product names should be unique in the root assembly product context
688  PRINT_ERROR( stepw_AddExternalReference( uniqueNameForLeafProduct, L"ExternalPartWithBody_ReferencedByFDT.step", assignedID_leafPart ) );//Declares the product named L"ExternalPartWithBody_ReferencedByFDT" as an external product (written in a separated file)
689  PRINT_ERROR( WritePart_UsedByExternalAssembly( uniqueNameForLeafProduct, assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
690 
691  int assignedID_instance1 = 0, assignedID_instance2 = 0, assignedID_instance3 = 0, assignedID_instance4 = 0;
692  int userID_instance1 = 101, userID_instance2 = 102, userID_instance3 = 103, userID_instance4 = 104;
693  int assignedID_subProduct = 0;
694  {//Creates sub-product
695  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
696 
697  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_subProduct, assignedID_leafPart, trf0, "ExternalPartWithBody_InSubProduct", Dtk_Info::create(), assignedID_instance1, userID_instance1, "RD1" ) );//Adds an instance of leaf product in sub-product
698 
699  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product product part context, required even if empty
700  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
701 
702  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product product context
703  }
704  {//Creates root product
705  int assignedID_rootProduct = 0;
706  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
707 
708  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1", Dtk_Info::create(), assignedID_instance3, userID_instance3, "RD3" ) );//Adds an instance of sub-product in root product
709  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2", Dtk_Info::create(), assignedID_instance4, userID_instance4, "RD4" ) );//Adds an instance of sub-product in root product
710  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_leafPart, trf0, "ExternalPartWithBody_InRootProduct", Dtk_Info::create(), assignedID_instance2, userID_instance2, "RD2" ) );//Adds an instance of leaf product in root product
711 
712  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context
713 
715  int userDefinedID_dimensionNode = 42;
716 
717  stepw_InitNodeContext( userDefinedID_dimensionNode );//Initializes root product FDT node context, with identifier specified by the user
718  PRINT_ERROR( stepw_Add3DPartFDT( dimension ) );//Registers created dimension in root product part
719 
720  //Writes geometrical links, using element reference and element reference path
721  {//Targets face with ID 73 in the 3D part (geometry) of instance "ExternalPartWithBody_InRootProduct"
722  int targetedFaceID_1 = 73; //see "FaceGDCH" in testcreatecube.cpp : it is a const Dtk_ID assigned to one of the face of the sample cube.
723  stepw_ER ElementReference_1;
724  PRINT_ERROR( stepw_CreateReference( ElementReference_1, targetedFaceID_1, assignedID_leafPart ) );
725  stepw_ERP ElementReferencePath_1;
726  PRINT_ERROR( stepw_CreateInstancePath( ElementReferencePath_1 ) );
727  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_1, assignedID_instance2 ) );
728  PRINT_ERROR( stepw_SetReferencePath( ElementReference_1, ElementReferencePath_1 ) );
729  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );
730  }
731  {//Targets face with ID 105 in the 3D part (geometry) of instance "ExternalPartWithBody_InSubProduct" in instance "SubProduct_InRootProduct_2".
732  int targetedFaceID_2 = 105; //see "FaceEHCA" in testcreatecube.cpp : it is a const Dtk_ID assigned to one of the face of the sample cube.
733  stepw_ER ElementReference_2;
734  PRINT_ERROR( stepw_CreateReference( ElementReference_2, targetedFaceID_2, assignedID_leafPart ) );
735  stepw_ERP ElementReferencePath_2;
736  PRINT_ERROR( stepw_CreateInstancePath( ElementReferencePath_2 ) );
737  {//Appends assigned instance identifiers individually
738  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_2, assignedID_instance4 ) );
739  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_2, assignedID_instance1 ) );
740  }
741  //{//Or define the whole instance identifier rout at once.
742  // Dtk_tab<Dtk_ID> instance_path;
743  // instance_path.push_back( assignedID_instance4 );
744  // instance_path.push_back( assignedID_instance1 );
745  // stepw_DefineInstancePath( ElementReferencePath_2, instance_path );
746  //}
747  PRINT_ERROR( stepw_SetReferencePath( ElementReference_2, ElementReferencePath_2 ) );
748  PRINT_ERROR( stepw_AddReference( ElementReference_2 ) );
749  }
750  stepw_EndNodeContext();//Ends root product FDT node context
751 
752  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
753  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
754  }
755 
756  return dtkNoError;
757  }

◆ WriteAssembly_BasicExternalReferences()

DtkErrorStatus stepw::sample::WriteAssembly_BasicExternalReferences ( const Dtk_string inRootAssemblyName)
601  {
602  Dtk_transfo trf0, trf1, trf2;
603  CreateTransforms( trf0, trf1, trf2 );
604 
605  int assignedID_leafPart = 0;
606  Dtk_string uniqueNameForProduct = L"ExternalPartWithBody";//Product names should be unique in the root assembly product context
607  PRINT_ERROR( stepw_AddExternalReference( uniqueNameForProduct, L"ExternalPartWithBody.step", assignedID_leafPart ) );//Declares the product named L"ExternalPartWithBody" as an external product (written in a separated file)
608  PRINT_ERROR( WritePart_BodyOnly( uniqueNameForProduct, assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
609 
610  int assignedID_subProduct = 0;
611  {//Creates sub-product
612  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
613  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "ExternalPartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
614 
615  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
616  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
617 
618  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
619  }
620  {//Creates root product
621  int assignedID_rootProduct = 0;
622  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
623 
624  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
625  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
626  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct" ) );//Adds an instance of leaf product in root product
627 
628  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
629  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
630 
631  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
632  }
633 
634  return dtkNoError;
635  }

◆ WriteAssembly_DimensionFDT()

DtkErrorStatus stepw::sample::WriteAssembly_DimensionFDT ( const Dtk_string inRootAssemblyName)
419  {
420  Dtk_transfo trf0, trf1, trf2;
421  CreateTransforms( trf0, trf1, trf2 );
422 
423  int assignedID_leafPart = 0;
424  PRINT_ERROR( WritePart_BodyOnly( L"PartWithBody", assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
425 
426  int assignedID_instance1 = 0, assignedID_instance2 = 0, assignedID_instance3 = 0;
427  int assignedID_subProduct = 0;
428  {//Creates sub-product
429  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
430 
431  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_subProduct, assignedID_leafPart, trf0, "PartWithBody_InSubProduct", Dtk_Info::create(), assignedID_instance1 ) );//Adds an instance of leaf product in sub-product
432 
433  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
434  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
435 
436  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
437  }
438  {//Creates root product
439  int assignedID_rootProduct = 0;
440  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
441 
442  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
443  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2", Dtk_Info::create(), assignedID_instance2 ) );//Adds an instance of sub-product in root product
444  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct", Dtk_Info::create(), assignedID_instance3 ) );//Adds an instance of leaf product in root product
445 
446  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context
447 
448  {//Creates assembly level FDT and its link to final geometry
449  Dtk_FdtPtr dimension = sampleWriter::CreateDimension();//Registers a FDT at assembly level
450  dimension->TransformationMatrix().setXdir( Dtk_dir( 0., 1., 0. ) );
451  dimension->TransformationMatrix().setYdir( Dtk_dir( -1., 0., 0. ) );
452  dimension->TransformationMatrix().setZdir( Dtk_dir( 0., 0., 1. ) );
453  dimension->TransformationMatrix().setOrigin( Dtk_pnt( 0., 0., -50. ) );
454 
455  int userDefinedID_dimensionNode = 1002;
456  stepw_InitNodeContext( userDefinedID_dimensionNode );
457  PRINT_ERROR( stepw_Add3DPartFDT( dimension ) );
458  {//Targets face with ID 10 in the 3D part (geometry) of instance "PartWithBody_InRootProduct"
459  int targetedFaceID_1 = 10;//This matches in the already written body in current part context, the entity with Dtk_Info::GetId() == 10 (a Dtk_FacePtr, see CreateCylinder)
460  stepw_ER ElementReference_1;
461  PRINT_ERROR( stepw_CreateReference( ElementReference_1, targetedFaceID_1, assignedID_leafPart ) );
462  stepw_ERP ElementReferencePath_1;
463  PRINT_ERROR( stepw_CreateInstancePath( ElementReferencePath_1 ) );
464  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_1, assignedID_instance3 ) );
465  PRINT_ERROR( stepw_SetReferencePath( ElementReference_1, ElementReferencePath_1 ) );
466  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );
467  }
468  {//Targets face with ID 10 in the 3D part (geometry) of instance "PartWithBody_InSubProduct" in instance "SubProduct_InRootProduct_2".
469  int targetedFaceID_2 = 10;//This matches in the already written body in current part context, the entity with Dtk_Info::GetId() == 10 (a Dtk_FacePtr, see CreateCylinder)
470  stepw_ER ElementReference_2;
471  PRINT_ERROR( stepw_CreateReference( ElementReference_2, targetedFaceID_2, assignedID_leafPart ) );
472  stepw_ERP ElementReferencePath_2;
473  PRINT_ERROR( stepw_CreateInstancePath( ElementReferencePath_2 ) );
474  {//Appends assigned instance identifiers individually
475  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_2, assignedID_instance2 ) );
476  PRINT_ERROR( stepw_AddInstanceToPath( ElementReferencePath_2, assignedID_instance1 ) );
477  }
478  //{//Or define the whole instance identifier rout at once.
479  // Dtk_tab<Dtk_ID> instance_path;
480  // instance_path.push_back( assignedID_instance2 );
481  // instance_path.push_back( assignedID_instance1 );
482  // stepw_DefineInstancePath( ElementReferencePath_2, instance_path );
483  //}
484  PRINT_ERROR( stepw_SetReferencePath( ElementReference_2, ElementReferencePath_2 ) );
485  PRINT_ERROR( stepw_AddReference( ElementReference_2 ) );
486  }
488  }
489  {
491  int viewModeThatReferencesAllFDTs = 1;
492  PRINT_ERROR( stepw_Add3DModelDisplay( view, viewModeThatReferencesAllFDTs ) );//Adds a view in the definition of the current part, that references all FDT of current part context
493  }
494  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
495 
496  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
497  }
498 
499  return dtkNoError;
500  }

◆ WriteAssembly_InstanceAttributes()

DtkErrorStatus stepw::sample::WriteAssembly_InstanceAttributes ( const Dtk_string inRootAssemblyName)
559  {
560  Dtk_transfo trf0, trf1, trf2;
561  CreateTransforms( trf0, trf1, trf2 );
562 
563  int assignedID_leafPart = 0;
564  PRINT_ERROR( WritePart_BodyOnly( L"PartWithBody", assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
565 
566  int assignedID_subProduct = 0;
567  {//Creates sub-product
568  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
569  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "PartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
570 
571  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
572  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
573 
574  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
575  }
576  {//Creates root product
577  int assignedID_rootProduct = 0;
578  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
579 
580  Dtk_InfoPtr first_instance_info = Dtk_Info::create();
581  first_instance_info->SetColor( Dtk_RGB( 10, 10, 10 ) );//Defines color of the first instance
582 
583  Dtk_InfoPtr second_instance_info = Dtk_Info::create();//Defines blanked status (invisibility) of the second instance
584  second_instance_info->SetBlankedStatus( 1 );
585 
586  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1", first_instance_info ) );//Adds an instance of sub-product in root product
587  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2", second_instance_info ) );//Adds an instance of sub-product in root product
588  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct" ) );//Adds an instance of leaf product in root product
589 
590  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
591  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
592 
593  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
594  }
595 
596  return dtkNoError;
597  }

◆ WriteAssembly_NestedExternalReferences()

DtkErrorStatus stepw::sample::WriteAssembly_NestedExternalReferences ( const Dtk_string inRootAssemblyName)
640  {
641  Dtk_transfo trf0, trf1, trf2;
642  CreateTransforms( trf0, trf1, trf2 );
643 
644  int assignedID_leafPart = 0;
645  Dtk_string uniqueNameForLeafProduct = L"NestedExternalPartWithBody";//Product names should be unique in the root assembly product context
646  PRINT_ERROR( stepw_AddExternalReference( uniqueNameForLeafProduct, L"NestedExternalPartWithBody.step", assignedID_leafPart ) );//Declares the product named L"ExternalPartWithBody" as an external product (written in a separated file)
647  PRINT_ERROR( WritePart_BodyOnly( uniqueNameForLeafProduct, assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
648 
649  int assignedID_subProduct = 0;
650  {//Creates sub-product
651  Dtk_string uniqueNameForSubProduct = L"NestedExternalSubProduct";//Product names should be unique in the root assembly product context
652  PRINT_ERROR( stepw_AddExternalReference( uniqueNameForSubProduct, L"NestedExternalSubProduct.step", assignedID_subProduct ) );//Declares the product named L"NestedExternalSubProduct" as an external product (written in a separated file)
653  PRINT_ERROR( stepw_InitProduct( uniqueNameForSubProduct, assignedID_subProduct ) );//Initializes sub-product context
654 
655  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "NestedExternalPartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
656 
657  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
658  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
659 
660  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
661  }
662  {//Creates root product
663  int assignedID_rootProduct = 0;
664  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
665 
666  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
667  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
668  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_leafPart, trf0, "NestedExternalPartWithBody_InRootProduct", Dtk_Info::create() ) );//Adds an instance of leaf product in root product
669 
670  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
671  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
672 
673  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
674  }
675 
676  return dtkNoError;
677  }

◆ WriteAssembly_WithProperties()

DtkErrorStatus stepw::sample::WriteAssembly_WithProperties ( const Dtk_string inRootAssemblyName)
505  {
506  Dtk_transfo trf0, trf1, trf2;
507  CreateTransforms( trf0, trf1, trf2 );
508 
509  int assignedID_leafPart = 0;
510  PRINT_ERROR( WritePart_BodyOnly( L"PartWithBody", assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
511 
512  int assignedID_subProduct = 0;
513  {//Creates sub-product
514  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
515  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "PartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
516 
517  {//Adds validation properties, AP242 form
518  Dtk_InfoPtr part_info = Dtk_Info::create();
519  Dtk_Val valprop_notional_CG( Dtk_pnt( 10., 20., 30. ) );
520  part_info->AddAttribute( "assembly validation property : : centre point", valprop_notional_CG );
521  PRINT_ERROR( stepw_SetPartProperties( part_info, 1 ) );//Adds properties at part level (PRODUCT_DEFINITION_SHAPE)
522 
523  Dtk_InfoPtr prod_info = Dtk_Info::create();
524  Dtk_Val valprop_nbchildren( 3 );
525  prod_info->AddAttribute( "assembly validation property : : number of children", valprop_nbchildren );
526  PRINT_ERROR( stepw_SetPartProperties( prod_info, 2 ) );//Adds properties at product level (PRODUCT_DEFINITION)
527  }
528 
529  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
530  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
531 
532  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
533  }
534  {//Creates root product
535  int assignedID_rootProduct = 0;
536  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
537 
538  Dtk_InfoPtr instance_info = Dtk_Info::create();
539  Dtk_Val instance_kind( "first" );
540  instance_info->AddAttribute( "user defined attribute : : instance kind", instance_kind );//Defines properties to assign to the instance
541  Dtk_Val instance_valprop( 1 );
542  instance_info->AddAttribute( "attribute validation property : : text user attributes", instance_valprop );//Defines properties to assign to the instance
543 
544  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1", instance_info ) );//Adds an instance of sub-product in root product
545  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
546  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct" ) );//Adds an instance of leaf product in root product
547 
548  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
549  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
550 
551  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
552  }
553 
554  return dtkNoError;
555  }

◆ WritePart_BodyAndMeshFromTessellation()

DtkErrorStatus stepw::sample::WritePart_BodyAndMeshFromTessellation ( const Dtk_string inPartName,
int &  outPartID 
)
160  {
161  Dtk_BodyPtr body = sampleWriter::CreateCylinder();//Constructs a body, int the shape of a cylinder
162 
163  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
164  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
165 
166  Dtk_MeshPtr mesh;
167  Dtk_tab<Dtk_MeshPtr> listMesh;
168  Dtk_tab<Dtk_Int32> IsSolid;
169  Dtk_bool TessWireframe = false;
170  tess_InitTesselation( "../../OutputFiles/", 0.2 );//Initializes tessellation library
171  PRINT_ERROR( tess_BodyToMeshes( body, listMesh, IsSolid, TessWireframe ) );//Tessellates brep into a meshes
172  if( listMesh.size() >= static_cast< Dtk_Size_t >( 1 ) )
173  mesh = listMesh[ 0 ];
174  PRINT_ERROR( stepw_Write3DPartBodyWithMesh( body, mesh ) );//Registers both the body geometry and its corresponding tessellated mesh, bounding their topology information
175 
176  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
177  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
178 
179  return dtkNoError;
180  }

◆ WritePart_BodyInNamedLayer()

DtkErrorStatus stepw::sample::WritePart_BodyInNamedLayer ( const Dtk_string inPartName,
int &  outPartID 
)
347  {
348  Dtk_BodyPtr body1 = sampleWriter::CreateCylinder();//Constructs a body, int the shape of a cylinder
349  body1->get_info()->SetLayer( 42 );//Assign it to layer 42
350  body1->GetEntity( 10 )->info()->SetLayer( 0 );//Assign entity with ID 10 (Dtk_Face) to layer 0
351  body1->GetEntity( 20 )->info()->SetLayer( 0 );//Assign entity with ID 20 (Dtk_Face) to layer 0
352  body1->GetEntity( 30 )->info()->SetLayer( 0 );//Assign entity with ID 30 (Dtk_Face) to layer 0
353 
354  Dtk_BodyPtr body2 = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
355  body2->get_info()->SetLayer( 1900 );//Assign it to layer 1900
356  Dtk_BodyPtr body3 = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
357  body3->get_info()->SetLayer( 1900 );//Assign it to layer 1900
358 
359 
360  Dtk_LayerInfosSetPtr layerInfosSet = sampleWriter::layer::CreateSet();//Create the layer infos set containing the name assigned to each layer
361 
362  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
363 
364  PRINT_ERROR( stepw_SetProductLayerInfosSet( layerInfosSet ) );//Set the current product layer infos set
365 
366  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
367  PRINT_ERROR( stepw_Write3DPartBody( body1 ) );//Registers body1 in part
368  PRINT_ERROR( stepw_Write3DPartBody( body2 ) );//Registers body2 in part
369  PRINT_ERROR( stepw_Write3DPartBody( body3 ) );//Registers body3 in part
370  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
371 
372  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
373 
374  return dtkNoError;
375  }

◆ WritePart_BodyOnly()

DtkErrorStatus stepw::sample::WritePart_BodyOnly ( const Dtk_string inPartName,
int &  outPartID 
)
67  {
68  Dtk_BodyPtr body = sampleWriter::CreateCylinder();//Constructs a body, in the shape of a cylinder
69 
70  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
71  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
72 
73  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Registers the 3D geometry in the current part context
74 
75  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
76  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
77 
78  return dtkNoError;
79  }

◆ WritePart_BodyWithAxisSystem()

DtkErrorStatus stepw::sample::WritePart_BodyWithAxisSystem ( const Dtk_string inPartName,
int &  outPartID 
)
85  {
87 
88  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
89  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
90 
91  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds a brep as definition of the 3D geometry of the part
92 
93  Dtk_AxisSystemPtr AxisSystem = CreateAxisSystem();
94  PRINT_ERROR( stepw_Write3DAxisSystem( AxisSystem ) );//Adds an axis system in the part context
95 
96  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
97  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
98 
99  return dtkNoError;
100  }

◆ WritePart_Datum()

DtkErrorStatus stepw::sample::WritePart_Datum ( const Dtk_string inPartName,
int &  outPartID 
)
221  {
222  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
223 
224  //You init the Part writer
225  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
226  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
227 
228  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
229  {
231  int nodeid_Fdt1 = 42;
232  stepw_InitNodeContext( nodeid_Fdt1 );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
233  PRINT_ERROR( stepw_Add3DPartFDT( Fdt1 ) );//Adds a FDT in the definition of current the part
234  {// Defines the geometrical links : within the same part
235  Dtk_FacePtr faceToTarget = Dtk_FacePtr::DtkDynamicCast( body->GetEntity( 73 ) );//Retrieves in body the entity with Dtk_Info::GetId() == 73 (a Dtk_FacePtr in this sample, see CreateCube_2)
236  stepw_ER ElementReference_1;
237  PRINT_ERROR( stepw_CreateReference( ElementReference_1, faceToTarget->info()->GetId() ) );//Creates a reference from the current part context, to a face identifier of the current part context
238  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
239  }
240  stepw_EndNodeContext();//Ends current node context
241 
243  int userDefinedID_viewNode = 4242;
244  stepw_InitNodeContext( userDefinedID_viewNode );//Starts another node context, this time to encapsulate the view entity
245  PRINT_ERROR( stepw_Add3DModelDisplay( view, 0 ) );//Add a view in the definition of the current part
246  {//Lets the view reference the FDT, meaning the FDT is visible in this view. An FDT can appear in several views.
247  stepw_ER ElementReference_Fdt1;
248  PRINT_ERROR( stepw_CreateReferenceToNode( ElementReference_Fdt1, nodeid_Fdt1, outPartID, "fdt" ) );//Create a reference from the current part context, to a whole node (FDT) of the current part context
249  PRINT_ERROR( stepw_AddReference( ElementReference_Fdt1 ) );//Registers this reference
250  }
251  stepw_EndNodeContext();//Ends current node context
252 
253  Dtk_AxisSystemPtr AxisSystem = CreateAxisSystem();
254  PRINT_ERROR( stepw_Write3DAxisSystem( AxisSystem ) );//Writes an axis system (complement FDT definition)
256  PRINT_ERROR( stepw_Write3DConstructionGeometry( constr_plane ) );//Writes a construction geometry (complement FDT definition)
257  }
258 
259  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
260  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
261 
262  return dtkNoError;
263  }

◆ WritePart_GeometricalTolerance()

DtkErrorStatus stepw::sample::WritePart_GeometricalTolerance ( const Dtk_string inPartName,
int &  outPartID 
)
269  {
270  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
271 
272  //You init the Part writer
273  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
274  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
275 
276  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
277  {
278  Dtk_FdtPtr datum = sampleWriter::CreateFdtDatum();//CReates datum "A"
279  int datum_node_id = 42;
280  stepw_InitNodeContext( datum_node_id );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
281  PRINT_ERROR( stepw_Add3DPartFDT( datum ) );//Adds a FDT in the definition of current the part
282  {// Defines the geometrical links : within the same part
283  Dtk_FacePtr faceToTarget = Dtk_FacePtr::DtkDynamicCast( body->GetEntity( 73 ) );//Retrieves in body the entity with Dtk_Info::GetId() == 73 (a Dtk_FacePtr in this sample, see CreateCube_2)
284  stepw_ER ElementReference_1;
285  PRINT_ERROR( stepw_CreateReference( ElementReference_1, faceToTarget->info()->GetId() ) );//Creates a reference from the current part context, to a face identifier of the current part context
286  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
287  }
288  stepw_EndNodeContext();//Ends current node context
289 
290  Dtk_transfo fdt_transf;
291  fdt_transf.setOrigin( Dtk_pnt( 75., 125., 50. ) );
292  Dtk_FdtPtr geometricalTolerance = sampleWriter::CreateGeometricalTolerance();//Creates a geometrical tolerance that references datum "A"
293  geometricalTolerance->Transform( fdt_transf );
294 
295  int geometrical_tolerance_node_id = 43;
296  stepw_InitNodeContext( geometrical_tolerance_node_id );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
297  PRINT_ERROR( stepw_Add3DPartFDT( geometricalTolerance ) );//Adds a FDT in the definition of current the part
298  {// Defines the geometrical links : within the same part
299  Dtk_FacePtr faceToTarget = Dtk_FacePtr::DtkDynamicCast( body->GetEntity( 105 ) );//Retrieves in body the entity with Dtk_Info::GetId() == 73 (a Dtk_FacePtr in this sample, see CreateCube_2)
300  stepw_ER ElementReference_1;
301  PRINT_ERROR( stepw_CreateReference( ElementReference_1, faceToTarget->info()->GetId() ) );//Creates a reference from the current part context, to a face identifier of the current part context
302  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
303  }
304  stepw_EndNodeContext();//Ends current node context
305 
307  int viewModeThatReferencesAllFDTs = 1;
308  PRINT_ERROR( stepw_Add3DModelDisplay( view, viewModeThatReferencesAllFDTs ) );//Adds a view in the definition of the current part, that references all FDT of current part context
309  }
310 
311  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
312  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
313 
314  return dtkNoError;
315  }

◆ WritePart_MeshOnly()

DtkErrorStatus stepw::sample::WritePart_MeshOnly ( const Dtk_string inPartName,
int &  outPartID 
)
122  {
123  Dtk_MeshPtr mesh = sampleWriter::CreateMeshCube();//Constructs a mesh, in the shape of a cube
124 
125  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
126  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
127 
128  PRINT_ERROR( stepw_Write3DPartMesh( mesh ) );//Adds a mesh as definition of the 3D geometry of the part
129 
130  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
131  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
132 
133  return dtkNoError;
134  }

◆ WritePart_MeshWithFaceColors()

DtkErrorStatus stepw::sample::WritePart_MeshWithFaceColors ( const Dtk_string inPartName,
int &  outPartID 
)
140  {
143 
144  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
145  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
146 
147  PRINT_ERROR( stepw_Write3DPartMesh( mesh ) );//Adds a mesh as definition of the 3D geometry of the part
148 
149  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
150  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
151 
152  return dtkNoError;
153  };

◆ WritePart_UsedByExternalAssembly()

DtkErrorStatus stepw::sample::WritePart_UsedByExternalAssembly ( const Dtk_string inPartName,
int &  outPartID 
)
320  {
321  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
322 
323  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
324 
325  int userDefinedID_product = 42;
326  PRINT_ERROR( stepw_SetAnchorProduct( outPartID, userDefinedID_product ) );//Declares the designated product as having an ANCHOR section, meaning it will be able to contain entities to be referenced outside of its scope
327  {
328  Dtk_FacePtr faceToTarget_1 = Dtk_FacePtr::DtkDynamicCast( body->GetEntity( 73 ) );//Retrieves in body the entity with Dtk_Info::GetId() == 73 (a Dtk_FacePtr in this sample, see CreateCube_2)
329  Dtk_string anchor1( "73" );
330  PRINT_ERROR( stepw_AddAnchorItem( faceToTarget_1->info()->GetId(), outPartID, anchor1 ) );//Registers this entity in the ANCHOR section, it can now be targeted by external files
331  Dtk_FacePtr faceToTarget_2 = Dtk_FacePtr::DtkDynamicCast( body->GetEntity( 105 ) );//Retrieves in body the entity with Dtk_Info::GetId() == 105 (a Dtk_FacePtr in this sample, see CreateCube_2)
332  Dtk_string anchor2( "105" );
333  PRINT_ERROR( stepw_AddAnchorItem( faceToTarget_2->info()->GetId(), outPartID, anchor2 ) );//Registers this entity in the ANCHOR section, it can now be targeted by external files
334  }
335 
336  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
337  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
338 
339  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
340  PRINT_ERROR( stepw_EndProduct( outPartID ) );
341 
342  return dtkNoError;
343  }

◆ WritePart_WireframeOnly()

DtkErrorStatus stepw::sample::WritePart_WireframeOnly ( const Dtk_string inPartName,
int &  outPartID 
)
105  {
107 
108  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
109  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
110 
111  PRINT_ERROR( stepw_Write3DPartBody( wireframe ) );//Adds a wireframe as definition of the 3D geometry of the part
112 
113  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
114  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
115 
116  return dtkNoError;
117  }

◆ WritePart_WithProperties()

DtkErrorStatus stepw::sample::WritePart_WithProperties ( const Dtk_string inPartName,
int &  outPartID 
)
185  {
186  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
187  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
188 
189  PRINT_ERROR( stepw_Add3DPartProperty( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeConfigurationProperty, "Revision", "test_revision_4" ) ) );//Defines and adds a property at part level (Dtk_MetaData)
190  PRINT_ERROR( stepw_Add3DPartProperty( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, "Cost", "12500 $" ) ) );//Defines and adds a property at part level (Dtk_MetaData)
191  PRINT_ERROR( stepw_Add3DPartProperty( Dtk_MetaDataWithUnit::CreateMetaDataWithUnits( Dtk_MetaData::TypeProperty, "User double with unit", "42.42", L"cm", L"REAL" ) ) );//Defines and adds a property at part level (Dtk_MetaData)
192 
193  {//Defines and adds validation properties at part level (Dtk_Info)
194  Dtk_InfoPtr part_info = Dtk_Info::create();
195  Dtk_Val valprop_area( "1234 mm2" );
196  part_info->AddAttribute( "geometric validation property : : surface area measure", valprop_area );
197  Dtk_Val valprop_volume( "5678 mm3" );
198  part_info->AddAttribute( "geometric validation property : : volume measure", valprop_volume );
199  Dtk_Val valprop_CG( Dtk_pnt( 12., 34., 56. ) );
200  part_info->AddAttribute( "geometric validation property : : centre point", valprop_CG );
201  PRINT_ERROR( stepw_SetPartProperties( part_info, 1 ) );
202  }
203  {//Defines and adds properties at product level (Dtk_Info)
204  Dtk_InfoPtr prod_info = Dtk_Info::create();
205  Dtk_Val mat_name( "Steel YC38" );
206  prod_info->AddAttribute( "material property : material name : Steel", mat_name );
207  Dtk_Val mat_density( "7.89 g/cm3" );
208  prod_info->AddAttribute( "material property : density : density measure", mat_density );
209  PRINT_ERROR( stepw_SetPartProperties( prod_info, 2 ) );
210  }
211 
212  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
213  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
214 
215  return dtkNoError;
216  }
sampleWriter::CreateCube_2
Dtk_BodyPtr CreateCube_2()
Definition: testcreatecylfdt.cpp:1064
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
sampleWriter::CreateCurves_2
Dtk_BodyPtr CreateCurves_2()
Definition: testcreatecylfdt.cpp:1108
Dtk_Info::AddAttribute
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:204
Dtk_transfo::setOrigin
void setOrigin(const Dtk_pnt &O)
Set a new O center point.
stepw_InitProduct
DtkErrorStatus stepw_InitProduct(const Dtk_string &inProductName, int &outAssignedID, Dtk_ID inProductUserID=0)
Initializes the definition context of a product.
stepw_AddInstanceToPath
DtkErrorStatus stepw_AddInstanceToPath(stepw_ERP &inOutElementReferencePath, const int inInstanceID)
Appends an instance identifier to the element reference path. The instance identifier is provided by ...
stepw_SetProductLayerInfosSet
DtkErrorStatus stepw_SetProductLayerInfosSet(const Dtk_LayerInfosSetPtr inLayerInfoSet)
Sets the LayerInfosSet to refer to when writing the current product. It uses its mapping between laye...
tess_InitTesselation
int tess_InitTesselation(Dtk_string inWorkingDirectory, double inTolerance)
Init the tesselation library.
stepw_Write3DConstructionGeometry
DtkErrorStatus stepw_Write3DConstructionGeometry(const Dtk_BodyPtr &inBody)
Writes a body as a construction geometry of a 3D part, of any kind (solid, shell / faces,...
stepw_ERP
Definition: stepw.hpp:445
stepw_Write3DPartMesh
DtkErrorStatus stepw_Write3DPartMesh(const Dtk_MeshPtr &inMesh)
Writes a mesh of a 3D part (3D content of a product).
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:704
Dtk_AxisSystem::create
static Dtk_SmartPtr< Dtk_AxisSystem > create()
Calls default constructor to allocate a new object.
PRINT_ERROR
#define PRINT_ERROR(inStatus)
Definition: testwriters.h:10
Dtk_bool
char Dtk_bool
Definition: define.h:717
stepw_Write3DPartBody
DtkErrorStatus stepw_Write3DPartBody(const Dtk_BodyPtr &inBody)
Writes a body of a 3D part (3D content of a product), of any kind (solid, shell / faces,...
stepw_Write3DPartBodyWithMesh
DtkErrorStatus stepw_Write3DPartBodyWithMesh(const Dtk_BodyPtr &inBody, const Dtk_MeshPtr &inMesh, const int inMode=0)
Writes a body of a 3D part (3D content of a product), associated with a mesh.
sampleWriter::FillFacesColors
void FillFacesColors(Dtk_MeshPtr &inoutCubeMesh)
Filling mesh faces with colors.
Definition: testcreatemesh.cpp:241
stepw_EndProduct
DtkErrorStatus stepw_EndProduct(const int inProductID)
Ends the writing of a product - calls WriteAssemblyInstances if not yet done.
Dtk_Info::SetBlankedStatus
Dtk_ErrorStatus SetBlankedStatus(const Dtk_Int32 &inBlankedStatus)
Dtk_MetaData::CreateMetaDataWithUnits
static Dtk_MetaDataPtr CreateMetaDataWithUnits(const MetaDataTypeEnum &inEnumType, Dtk_string inTitle, Dtk_string inValue, Dtk_string inUnits, Dtk_string inValueType=Dtk_string(L"STRING"))
Create a Dtk_MetaDataPtr .
Dtk_Val
Definition: dtk_val.hpp:67
stepw_Add3DPartProperty
Dtk_ErrorStatus stepw_Add3DPartProperty(const Dtk_MetaDataPtr &inProperty)
Adds a roperty to a part (default), or to an entity, according to InitPropertySet mode.
stepw_SetReferencePath
DtkErrorStatus stepw_SetReferencePath(stepw_ER &inOutElementReference, stepw_ERP &inElementReferencePath)
Assigns the element reference path to the element reference.
stepw_CreateReference
DtkErrorStatus stepw_CreateReference(stepw_ER &inOutElementReference, const int inEntityID, const int inProductID=0, const char *inReferenceKind="")
Creates a reference to an entity located in the designated Product/Part context, or current context i...
stepw::sample::WritePart_BodyOnly
DtkErrorStatus WritePart_BodyOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:66
stepw_AddExternalReference
Dtk_ErrorStatus stepw_AddExternalReference(const Dtk_string &inProductName, const Dtk_string &inFileName, int &outID, Dtk_ID inInstCompId=0)
Declares a product to be written as an external reference (separated file).
stepw_Init3DPart
DtkErrorStatus stepw_Init3DPart(const int inProductID)
Initializes the writing of a 3D part for the designated product.
stepw::sample::Write_MinimumViableFile
DtkErrorStatus Write_MinimumViableFile(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:41
stepw_AddInstanceWithInfo
DtkErrorStatus stepw_AddInstanceWithInfo(const int inFatherProductID, const int inChildProductID, const Dtk_transfo &inPosition, const Dtk_string &inInstanceName, const Dtk_InfoPtr &inInstanceInfo)
Adds an instance of a product ( child ) in an assembly product ( father ), with provided attributes.
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Creates simple Datum.
Definition: testcreatefdt.cpp:15
tess_BodyToMeshes
Dtk_ErrorStatus tess_BodyToMeshes(const Dtk_BodyPtr &inBodyToWrite, Dtk_tab< Dtk_MeshPtr > &outMeshes, Dtk_tab< Dtk_Int32 > &outIsSolid, Dtk_bool inTessWireframe=DTK_FALSE, Dtk_bool inApplyRenderInfos=DTK_FALSE)
Tesselate a body. Generates one mesh per shell in the body.
Dtk_MetaData::TypeConfigurationProperty
@ TypeConfigurationProperty
Definition: dtk_metadata.hpp:30
stepw_AddInstance
DtkErrorStatus stepw_AddInstance(const int inFatherProductID, const int inChildProductID, const Dtk_transfo &inPosition, const Dtk_string &inInstanceName)
Adds an instance of a product ( child ) in an assembly product ( father ).
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:28
stepw_Add3DPartFDT
DtkErrorStatus stepw_Add3DPartFDT(const Dtk_FdtPtr &inFDT)
Adds a FDT in the current part context.
Dtk_SmartPtr< Dtk_Face >::DtkDynamicCast
static Dtk_SmartPtr< Dtk_Face > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
sampleWriter::CreateConstructionPlane
Dtk_BodyPtr CreateConstructionPlane()
Definition: testcreatecylfdt.cpp:1155
stepw_SetPartProperties
DtkErrorStatus stepw_SetPartProperties(const Dtk_InfoPtr &inInfo, const int inItem)
Defines properties to be attached directly to the product : considers the list of Dtk_Val in the Dtk_...
stepw_SetAnchorProduct
DtkErrorStatus stepw_SetAnchorProduct(const int inProductID, const int inUserID)
Declares the product as having an ANCHOR section. If the designated product is already declared as su...
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
stepw_End3DPart
DtkErrorStatus stepw_End3DPart()
Ends the writing of a product 3D part.
stepw_Write3DAxisSystem
DtkErrorStatus stepw_Write3DAxisSystem(const Dtk_AxisSystemPtr &inAxis)
Writes an axis system of a 3D part, in STEP, it is a construction geometry based on an axis placement...
stepw::sample::CreateAxisSystem
Dtk_AxisSystemPtr CreateAxisSystem()
Definition: testlibstepwrite.cpp:20
stepw_AddReference
DtkErrorStatus stepw_AddReference(stepw_ER &inElementReference)
Registers the previously created element reference in the writer.
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
stepw_Add3DModelDisplay
Dtk_ErrorStatus stepw_Add3DModelDisplay(const Dtk_ModelDisplayPtr &inModelDisplay, const int inMode)
Adds a view ( Dtk_ModelDisplay ) in the current part context.
stepw::sample::WritePart_UsedByExternalAssembly
DtkErrorStatus WritePart_UsedByExternalAssembly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:319
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Definition: testcreatefdt.cpp:320
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
stepw_ER
Definition: stepw.hpp:438
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
stepw_CreateInstancePath
DtkErrorStatus stepw_CreateInstancePath(stepw_ERP &inOutElementReferencePath)
Initializes a path for the element reference, identifying the sequence of instances to pass through.
stepw_SetHeaderData
DtkErrorStatus stepw_SetHeaderData(const int inNumItem, const wchar_t *inValItem)
Sets STEP file header fields value.
stepw_CreateReferenceToNode
DtkErrorStatus stepw_CreateReferenceToNode(stepw_ER &inOutElementReference, const int inNodeID, const int inProductID=0, const char *inReferenceKind="")
Creates a reference to a whole node (Dtk_Node), located in the designated Product/Part context.
sampleWriter::CreateCylinder
Dtk_BodyPtr CreateCylinder()
Definition: testcreatecylfdt.cpp:1179
stepw_EndNodeContext
void stepw_EndNodeContext(const int unused=0)
Ends current node context.
sampleWriter::CreateDimension
Dtk_FdtPtr CreateDimension()
Definition: testcreatefdt.cpp:112
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:149
Dtk_Info::GetId
int GetId() const
Dtk_RGB
Definition: dtk_rgb.hpp:7
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
sampleWriter::layer::CreateSet
Dtk_LayerInfosSetPtr CreateSet()
Create Layer info set.
Definition: testcreatelayerinfoset.cpp:14
stepw::sample::CreateTransforms
void CreateTransforms(Dtk_transfo &outFirst, Dtk_transfo &outSecond, Dtk_transfo &outThird)
Definition: testlibstepwrite.cpp:30
Dtk_Info::create
static Dtk_SmartPtr< Dtk_Info > create()
Calls default constructor to allocate a new object.
stepw_InitNodeContext
void stepw_InitNodeContext(const int inNodeID)
Initializes the context to write entities in a node.
stepw_AddAnchorItem
Dtk_ErrorStatus stepw_AddAnchorItem(const int inEntityID, const int inProductID, const Dtk_string &inGUID)
Registers an entity in the ANCHOR section, with an assigned GUID (optional).
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
sampleWriter::CreateGeometricalTolerance
Dtk_FdtPtr CreateGeometricalTolerance()
Definition: testcreatefdt.cpp:225
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()