DATAKIT API  V2025.4
stepw::sample Namespace Reference

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

Functions

Dtk_AxisSystemPtr CreateAxisSystem ()
 
Dtk_LayerInfosSetPtr CreateLayerInfosSet ()
 
void CreateTransforms (Dtk_transfo &outFirst, Dtk_transfo &outSecond, Dtk_transfo &outThird)
 
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 ( )
24  {
26  Dtk_transfo trsf;
27  trsf.setOrigin( Dtk_pnt( 100., 100., 100. ) );
28  axis->SetMatrix( trsf );
29  axis->SetName( "Axis_System" );
30  return axis;
31  }

◆ CreateLayerInfosSet()

Dtk_LayerInfosSetPtr stepw::sample::CreateLayerInfosSet ( )
43  {
45  layerInfosSet->SetLayerID(0, 42);
46  layerInfosSet->SetLayerID(1, 1900);
47  layerInfosSet->SetLayerID(2, 0);
48  layerInfosSet->SetLayerName(0, "MyFirstLayer");
49  layerInfosSet->SetLayerName(1, "MySecondLayer");
50  layerInfosSet->SetLayerName(2, "Faces");
51  return layerInfosSet;
52  }

◆ CreateTransforms()

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

◆ WriteAssembly()

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

◆ WriteAssembly_BasicExternalReference_DimensionFDT()

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

◆ WriteAssembly_BasicExternalReferences()

DtkErrorStatus stepw::sample::WriteAssembly_BasicExternalReferences ( const Dtk_string inRootAssemblyName)
592  {
593  Dtk_transfo trf0, trf1, trf2;
594  CreateTransforms( trf0, trf1, trf2 );
595 
596  int assignedID_leafPart = 0;
597  Dtk_string uniqueNameForProduct = L"ExternalPartWithBody";//Product names should be unique in the root assembly product context
598  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)
599  PRINT_ERROR( WritePart_BodyOnly( uniqueNameForProduct, assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
600 
601  int assignedID_subProduct = 0;
602  {//Creates sub-product
603  PRINT_ERROR( stepw_InitProduct( L"SubProduct", assignedID_subProduct ) );//Initializes sub-product context
604  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "ExternalPartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
605 
606  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
607  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
608 
609  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
610  }
611  {//Creates root product
612  int assignedID_rootProduct = 0;
613  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
614 
615  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
616  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
617  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_leafPart, trf0, "PartWithBody_InRootProduct" ) );//Adds an instance of leaf product in root product
618 
619  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
620  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
621 
622  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
623  }
624 
625  return dtkNoError;
626  }

◆ WriteAssembly_DimensionFDT()

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

◆ WriteAssembly_InstanceAttributes()

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

◆ WriteAssembly_NestedExternalReferences()

DtkErrorStatus stepw::sample::WriteAssembly_NestedExternalReferences ( const Dtk_string inRootAssemblyName)
631  {
632  Dtk_transfo trf0, trf1, trf2;
633  CreateTransforms( trf0, trf1, trf2 );
634 
635  int assignedID_leafPart = 0;
636  Dtk_string uniqueNameForLeafProduct = L"NestedExternalPartWithBody";//Product names should be unique in the root assembly product context
637  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)
638  PRINT_ERROR( WritePart_BodyOnly( uniqueNameForLeafProduct, assignedID_leafPart ) );//Creates leaf product, to be done first in order to be able to instanciate it
639 
640  int assignedID_subProduct = 0;
641  {//Creates sub-product
642  Dtk_string uniqueNameForSubProduct = L"NestedExternalSubProduct";//Product names should be unique in the root assembly product context
643  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)
644  PRINT_ERROR( stepw_InitProduct( uniqueNameForSubProduct, assignedID_subProduct ) );//Initializes sub-product context
645 
646  PRINT_ERROR( stepw_AddInstance( assignedID_subProduct, assignedID_leafPart, trf0, "NestedExternalPartWithBody_InSubProduct" ) );//Adds an instance of leaf product in sub-product
647 
648  PRINT_ERROR( stepw_Init3DPart( assignedID_subProduct ) );//Initializes sub-product part context, required even if empty
649  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
650 
651  PRINT_ERROR( stepw_EndProduct( assignedID_subProduct ) );//Ends sub-product context
652  }
653  {//Creates root product
654  int assignedID_rootProduct = 0;
655  PRINT_ERROR( stepw_InitProduct( inRootAssemblyName, assignedID_rootProduct ) );//Initializes root product context
656 
657  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf1, "SubProduct_InRootProduct_1" ) );//Adds an instance of sub-product in root product
658  PRINT_ERROR( stepw_AddInstance( assignedID_rootProduct, assignedID_subProduct, trf2, "SubProduct_InRootProduct_2" ) );//Adds an instance of sub-product in root product
659  PRINT_ERROR( stepw_AddInstanceWithInfo( assignedID_rootProduct, assignedID_leafPart, trf0, "NestedExternalPartWithBody_InRootProduct", Dtk_Info::create() ) );//Adds an instance of leaf product in root product
660 
661  PRINT_ERROR( stepw_Init3DPart( assignedID_rootProduct ) );//Initializes root product part context, required even if empty
662  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
663 
664  PRINT_ERROR( stepw_EndProduct( assignedID_rootProduct ) );//Ends root product context
665  }
666 
667  return dtkNoError;
668  }

◆ WriteAssembly_WithProperties()

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

◆ WritePart_BodyAndMeshFromTessellation()

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

◆ WritePart_BodyInNamedLayer()

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

◆ WritePart_BodyOnly()

DtkErrorStatus stepw::sample::WritePart_BodyOnly ( const Dtk_string inPartName,
int &  outPartID 
)
57  {
58  Dtk_BodyPtr body = sampleWriter::CreateCylinder();//Constructs a body, in the shape of a cylinder
59 
60  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
61  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
62 
63  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Registers the 3D geometry in the current part context
64 
65  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
66  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
67 
68  return dtkNoError;
69  }

◆ WritePart_BodyWithAxisSystem()

DtkErrorStatus stepw::sample::WritePart_BodyWithAxisSystem ( const Dtk_string inPartName,
int &  outPartID 
)
75  {
77 
78  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
79  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
80 
81  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds a brep as definition of the 3D geometry of the part
82 
83  Dtk_AxisSystemPtr AxisSystem = CreateAxisSystem();
84  PRINT_ERROR( stepw_Write3DAxisSystem( AxisSystem ) );//Adds an axis system in the part context
85 
86  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
87  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
88 
89  return dtkNoError;
90  }

◆ WritePart_Datum()

DtkErrorStatus stepw::sample::WritePart_Datum ( const Dtk_string inPartName,
int &  outPartID 
)
211  {
212  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
213 
214  //You init the Part writer
215  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
216  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
217 
218  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
219  {
221  int nodeid_Fdt1 = 42;
222  stepw_InitNodeContext( nodeid_Fdt1 );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
223  PRINT_ERROR( stepw_Add3DPartFDT( Fdt1 ) );//Adds a FDT in the definition of current the part
224  {// Defines the geometrical links : within the same part
225  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)
226  stepw_ER ElementReference_1;
227  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
228  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
229  }
230  stepw_EndNodeContext();//Ends current node context
231 
233  int userDefinedID_viewNode = 4242;
234  stepw_InitNodeContext( userDefinedID_viewNode );//Starts another node context, this time to encapsulate the view entity
235  PRINT_ERROR( stepw_Add3DModelDisplay( view, 0 ) );//Add a view in the definition of the current part
236  {//Lets the view reference the FDT, meaning the FDT is visible in this view. An FDT can appear in several views.
237  stepw_ER ElementReference_Fdt1;
238  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
239  PRINT_ERROR( stepw_AddReference( ElementReference_Fdt1 ) );//Registers this reference
240  }
241  stepw_EndNodeContext();//Ends current node context
242 
243  Dtk_AxisSystemPtr AxisSystem = CreateAxisSystem();
244  PRINT_ERROR( stepw_Write3DAxisSystem( AxisSystem ) );//Writes an axis system (complement FDT definition)
246  PRINT_ERROR( stepw_Write3DConstructionGeometry( constr_plane ) );//Writes a construction geometry (complement FDT definition)
247  }
248 
249  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
250  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
251 
252  return dtkNoError;
253  }

◆ WritePart_GeometricalTolerance()

DtkErrorStatus stepw::sample::WritePart_GeometricalTolerance ( const Dtk_string inPartName,
int &  outPartID 
)
259  {
260  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
261 
262  //You init the Part writer
263  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
264  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
265 
266  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
267  {
268  Dtk_FdtPtr datum = sampleWriter::CreateFdtDatum();//CReates datum "A"
269  int datum_node_id = 42;
270  stepw_InitNodeContext( datum_node_id );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
271  PRINT_ERROR( stepw_Add3DPartFDT( datum ) );//Adds a FDT in the definition of current the part
272  {// Defines the geometrical links : within the same part
273  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)
274  stepw_ER ElementReference_1;
275  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
276  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
277  }
278  stepw_EndNodeContext();//Ends current node context
279 
280  Dtk_transfo fdt_transf;
281  fdt_transf.setOrigin( Dtk_pnt( 75., 125., 50. ) );
282  Dtk_FdtPtr geometricalTolerance = sampleWriter::CreateGeometricalTolerance();//Creates a geometrical tolerance that references datum "A"
283  geometricalTolerance->Transform( fdt_transf );
284 
285  int geometrical_tolerance_node_id = 43;
286  stepw_InitNodeContext( geometrical_tolerance_node_id );//Starts a node context to encapsulate an entity and be able to reference it from other nodes context
287  PRINT_ERROR( stepw_Add3DPartFDT( geometricalTolerance ) );//Adds a FDT in the definition of current the part
288  {// Defines the geometrical links : within the same part
289  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)
290  stepw_ER ElementReference_1;
291  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
292  PRINT_ERROR( stepw_AddReference( ElementReference_1 ) );//Registers this reference
293  }
294  stepw_EndNodeContext();//Ends current node context
295 
297  int viewModeThatReferencesAllFDTs = 1;
298  PRINT_ERROR( stepw_Add3DModelDisplay( view, viewModeThatReferencesAllFDTs ) );//Adds a view in the definition of the current part, that references all FDT of current part context
299  }
300 
301  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
302  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
303 
304  return dtkNoError;
305  }

◆ WritePart_MeshOnly()

DtkErrorStatus stepw::sample::WritePart_MeshOnly ( const Dtk_string inPartName,
int &  outPartID 
)
112  {
113  Dtk_MeshPtr mesh = sampleWriter::CreateMeshCube();//Constructs a mesh, in the shape of a cube
114 
115  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
116  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
117 
118  PRINT_ERROR( stepw_Write3DPartMesh( mesh ) );//Adds a mesh as definition of the 3D geometry of the part
119 
120  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
121  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
122 
123  return dtkNoError;
124  }

◆ WritePart_MeshWithFaceColors()

DtkErrorStatus stepw::sample::WritePart_MeshWithFaceColors ( const Dtk_string inPartName,
int &  outPartID 
)
130  {
133 
134  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
135  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
136 
137  PRINT_ERROR( stepw_Write3DPartMesh( mesh ) );//Adds a mesh as definition of the 3D geometry of the part
138 
139  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
140  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
141 
142  return dtkNoError;
143  };

◆ WritePart_UsedByExternalAssembly()

DtkErrorStatus stepw::sample::WritePart_UsedByExternalAssembly ( const Dtk_string inPartName,
int &  outPartID 
)
310  {
311  Dtk_BodyPtr body = sampleWriter::CreateCube_2();//Constructs a body, int the shape of a cube
312 
313  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
314 
315  int userDefinedID_product = 42;
316  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
317  {
318  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)
319  Dtk_string anchor1( "73" );
320  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
321  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)
322  Dtk_string anchor2( "105" );
323  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
324  }
325 
326  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
327  PRINT_ERROR( stepw_Write3DPartBody( body ) );//Adds body as definition of the 3D geometry of the part
328 
329  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
330  PRINT_ERROR( stepw_EndProduct( outPartID ) );
331 
332  return dtkNoError;
333  }

◆ WritePart_WireframeOnly()

DtkErrorStatus stepw::sample::WritePart_WireframeOnly ( const Dtk_string inPartName,
int &  outPartID 
)
95  {
97 
98  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) );//Initializes root product context
99  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Initializes a part context
100 
101  PRINT_ERROR( stepw_Write3DPartBody( wireframe ) );//Adds a wireframe as definition of the 3D geometry of the part
102 
103  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
104  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
105 
106  return dtkNoError;
107  }

◆ WritePart_WithProperties()

DtkErrorStatus stepw::sample::WritePart_WithProperties ( const Dtk_string inPartName,
int &  outPartID 
)
175  {
176  PRINT_ERROR( stepw_InitProduct( inPartName, outPartID ) )//Initializes root product context
177  PRINT_ERROR( stepw_Init3DPart( outPartID ) );//Starts a part definition context
178 
179  PRINT_ERROR( stepw_Add3DPartProperty( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeConfigurationProperty, "Revision", "test_revision_4" ) ) );//Defines and adds a property at part level (Dtk_MetaData)
180  PRINT_ERROR( stepw_Add3DPartProperty( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, "Cost", "12500 $" ) ) );//Defines and adds a property at part level (Dtk_MetaData)
181  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)
182 
183  {//Defines and adds validation properties at part level (Dtk_Info)
184  Dtk_InfoPtr part_info = Dtk_Info::create();
185  Dtk_Val valprop_area( "1234 mm2" );
186  part_info->AddAttribute( "geometric validation property : : surface area measure", valprop_area );
187  Dtk_Val valprop_volume( "5678 mm3" );
188  part_info->AddAttribute( "geometric validation property : : volume measure", valprop_volume );
189  Dtk_Val valprop_CG( Dtk_pnt( 12., 34., 56. ) );
190  part_info->AddAttribute( "geometric validation property : : centre point", valprop_CG );
191  PRINT_ERROR( stepw_SetPartProperties( part_info, 1 ) );
192  }
193  {//Defines and adds properties at product level (Dtk_Info)
194  Dtk_InfoPtr prod_info = Dtk_Info::create();
195  Dtk_Val mat_name( "Steel YC38" );
196  prod_info->AddAttribute( "material property : material name : Steel", mat_name );
197  Dtk_Val mat_density( "7.89 g/cm3" );
198  prod_info->AddAttribute( "material property : density : density measure", mat_density );
199  PRINT_ERROR( stepw_SetPartProperties( prod_info, 2 ) );
200  }
201 
202  PRINT_ERROR( stepw_End3DPart() );//Ends current part context
203  PRINT_ERROR( stepw_EndProduct( outPartID ) );//Ends root product context
204 
205  return dtkNoError;
206  }
sampleWriter::CreateCube_2
Dtk_BodyPtr CreateCube_2()
Definition: testcreatecylfdt.cpp:1070
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
sampleWriter::CreateCurves_2
Dtk_BodyPtr CreateCurves_2()
Definition: testcreatecylfdt.cpp:1114
Dtk_Info::AddAttribute
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:209
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...
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:443
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:58
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:714
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:727
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.
tess_InitTesselation
int tess_InitTesselation(Dtk_string inWorkingDirectory, double inTolerance)
Init the tesselation library.
sampleWriter::FillFacesColors
void FillFacesColors(Dtk_MeshPtr &inoutCubeMesh)
Filling mesh faces with colors.
Definition: testcreatemesh.cpp:246
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:56
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_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:19
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::DtkDynamicCast
static Dtk_SmartPtr< T > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
sampleWriter::CreateConstructionPlane
Dtk_BodyPtr CreateConstructionPlane()
Definition: testcreatecylfdt.cpp:1161
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:23
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:22
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:309
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)
: Make Tesselation from a Dtk_body and create a Set of Dtk_mesh if available
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Definition: testcreatefdt.cpp:324
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:85
stepw_ER
Definition: stepw.hpp:436
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:504
stepw_CreateInstancePath
DtkErrorStatus stepw_CreateInstancePath(stepw_ERP &inOutElementReferencePath)
Initializes a path for the element reference, identifying the sequence of instances to pass through.
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:1185
stepw_EndNodeContext
void stepw_EndNodeContext(const int unused=0)
Ends current node context.
sampleWriter::CreateDimension
Dtk_FdtPtr CreateDimension()
Definition: testcreatefdt.cpp:116
Dtk_LayerInfosSet::Create
static Dtk_LayerInfosSetPtr Create(const Dtk_Size_t inNumLayers)
Calls a constructor to allocate a new object.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:144
stepw::sample::CreateLayerInfosSet
Dtk_LayerInfosSetPtr CreateLayerInfosSet()
Definition: testlibstepwrite.cpp:42
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)
stepw::sample::CreateTransforms
void CreateTransforms(Dtk_transfo &outFirst, Dtk_transfo &outSecond, Dtk_transfo &outThird)
Definition: testlibstepwrite.cpp:33
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:15
sampleWriter::CreateGeometricalTolerance
Dtk_FdtPtr CreateGeometricalTolerance()
Definition: testcreatefdt.cpp:229
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()