DATAKIT SDK  V2026.1
testlibstepwrite.cpp File Reference

Namespaces

 stepw
 Exported APIs for STEP Write Library.
 
 stepw::sample
 Set of sample functions to write specific data into a .stp file.
 

Functions

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

Function Documentation

◆ StepWriteSample()

int StepWriteSample ( const Dtk_string inResultDirectory)
775 {
776  Dtk_string outputFileName, outputDirectory;
777 
778  std::cout << endl << "----------------------------------------------" << std::endl;
779  std::cout << "Step Write start" << std::endl;
780 
781  stepw_SetModeProp( 3 );
782  stepw_SetModeFdt( 1 );
783 
784  // Choosing output directory and file name
785  outputDirectory = inResultDirectory + L"Step/";
786  outputDirectory.FixPathSeparator();
787  outputDirectory.mkdir();
788 
789  // First, initialize the Step writer
790  //int codeForAP203 = 1;
791  int codeForAP214 = 2;
792  //int codeForAP203E2 = 3;
793  int codeForAP242 = 4;
794  int dummy;
795  {
796  outputFileName = outputDirectory + L"SampleMinimumProduct.step";
797  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
798  PRINT_ERROR( stepw::sample::Write_MinimumViableFile( L"SampleMinimumProduct", dummy ) );
800  std::cout << "=> " << outputFileName.c_str() << std::endl;
801  }
802  //[...]
803  //end_of_mainstepwrite
804  {
805  outputFileName = outputDirectory + L"SampleMinimumProduct_UserDefinedHeader.step";
806  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
807  stepw::sample::Write_UserDefinedHeader( L"SampleMinimumProduct_UserDefinedHeader", dummy );
809  std::cout << "=> " << outputFileName.c_str() << std::endl;
810  }
811  {
812  outputFileName = outputDirectory + L"SamplePart_BodyOnly.step";
813  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
814  stepw::sample::WritePart_BodyOnly( L"SamplePart_BodyOnly", dummy );
816  std::cout << "=> " << outputFileName.c_str() << std::endl;
817  }
818  {
819  outputFileName = outputDirectory + L"SamplePart_BodyWithAxisSystem.step";
820  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
821  stepw::sample::WritePart_BodyWithAxisSystem( L"SamplePart_BodyWithAxisSystem", dummy );
823  std::cout << "=> " << outputFileName.c_str() << std::endl;
824  }
825  {
826  outputFileName = outputDirectory + L"SamplePart_WireframeOnly.step";
827  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
828  stepw::sample::WritePart_WireframeOnly( L"SamplePart_WireframeOnly", dummy );
830  std::cout << "=> " << outputFileName.c_str() << std::endl;
831  }
832  {
833  outputFileName = outputDirectory + L"SamplePart_MeshOnly.step";
834  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
835  stepw::sample::WritePart_MeshOnly( L"SamplePart_MeshOnly", dummy );
837  std::cout << "=> " << outputFileName.c_str() << std::endl;
838  }
839  {
840  outputFileName = outputDirectory + L"SamplePart_MeshWithFaceColors.step";
841  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
842  stepw::sample::WritePart_MeshWithFaceColors( L"SamplePart_MeshWithFaceColors", dummy );
844  std::cout << "=> " << outputFileName.c_str() << std::endl;
845  }
846  {
847  outputFileName = outputDirectory + L"SamplePart_BodyAndMeshFromTessellation.step";
848  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
849  stepw::sample::WritePart_BodyAndMeshFromTessellation( L"SamplePart_BodyAndMeshFromTessellation", dummy );
851  std::cout << "=> " << outputFileName.c_str() << std::endl;
852  }
853  {
854  outputFileName = outputDirectory + L"SamplePart_WithProperties.step";
855  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
856  stepw::sample::WritePart_WithProperties( L"SamplePart_WithProperties", dummy );
858  std::cout << "=> " << outputFileName.c_str() << std::endl;
859  }
860  {
861  outputFileName = outputDirectory + L"SamplePart_BodyInNamedLayer.step";
862  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
863  stepw::sample::WritePart_BodyInNamedLayer( L"SamplePart_BodyInNamedLayer", dummy );
865  std::cout << "=> " << outputFileName.c_str() << std::endl;
866  }
867  {
868  outputFileName = outputDirectory + L"SamplePart_Datum.step";
869  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
870  stepw::sample::WritePart_Datum( L"SamplePart_Datum", dummy );
872  std::cout << "=> " << outputFileName.c_str() << std::endl;
873  }
874  {
875  outputFileName = outputDirectory + L"SamplePart_GeometricalTolerance.step";
876  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
877  stepw::sample::WritePart_GeometricalTolerance( L"SamplePart_GeometricalTolerance", dummy );
879  std::cout << "=> " << outputFileName.c_str() << std::endl;
880  }
881  {
882  outputFileName = outputDirectory + L"SamplePart_UsedByExternalAssembly.step";
883  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
884  stepw::sample::WritePart_UsedByExternalAssembly( L"SamplePart_UsedByExternalAssembly", dummy );
886  std::cout << "=> " << outputFileName.c_str() << std::endl;
887  }
888  {
889  outputFileName = outputDirectory + L"SampleAssembly.step";
890  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
891  stepw::sample::WriteAssembly( L"SampleAssembly" );
893  std::cout << "=> " << outputFileName.c_str() << std::endl;
894  }
895  {
896  outputFileName = outputDirectory + L"SampleAssembly_DimensionFDT.step";
897  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
898  stepw::sample::WriteAssembly_DimensionFDT( L"SampleAssembly_DimensionFDT");
900  std::cout << "=> " << outputFileName.c_str() << std::endl;
901  }
902  {
903  outputFileName = outputDirectory + L"SampleAssembly_WithProperties.step";
904  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
905  stepw::sample::WriteAssembly_WithProperties( L"SampleAssembly_WithProperties");
907  std::cout << "=> " << outputFileName.c_str() << std::endl;
908  }
909  {
910  outputFileName = outputDirectory + L"SampleAssembly_InstanceAttributes.step";
911  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
912  stepw::sample::WriteAssembly_InstanceAttributes( L"SampleAssembly_InstanceAttributes" );
914  std::cout << "=> " << outputFileName.c_str() << std::endl;
915  }
916  {
917  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReferences.step";
918  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
919  stepw::sample::WriteAssembly_BasicExternalReferences( L"SampleAssembly_BasicExternalReferences");
921  std::cout << "=> " << outputFileName.c_str() << std::endl;
922  }
923  {
924  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReference_DimensionFDT.step";
925  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
926  stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT( L"SampleAssembly_BasicExternalReference_DimensionFDT");
928  std::cout << "=> " << outputFileName.c_str() << std::endl;
929  }
930  {
931  outputFileName = outputDirectory + L"SampleAssembly_NestedExternalReferences.step";
932  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
933  stepw::sample::WriteAssembly_NestedExternalReferences( L"SampleAssembly_NestedExternalReferences");
935  std::cout << "=> " << outputFileName.c_str() << std::endl;
936  }
937 
938  std::cout << "Step Write end" << std::endl;
939 
940  return 0;
941 }
stepw::sample::WritePart_MeshOnly
DtkErrorStatus WritePart_MeshOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:132
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
stepw::sample::WritePart_BodyWithAxisSystem
DtkErrorStatus WritePart_BodyWithAxisSystem(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:95
PRINT_ERROR
#define PRINT_ERROR(inStatus)
Definition: testwriters.h:10
stepw::sample::WritePart_WireframeOnly
DtkErrorStatus WritePart_WireframeOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:115
stepw_SetModeProp
DtkErrorStatus stepw_SetModeProp(const int inMode)
Activates/Deactivates writing of properties : User Attributes, Product Data.
stepw_InitFile
DtkErrorStatus stepw_InitFile(const Dtk_string &inFileName, const char *inOriginatingSystem=" user ", const int inSchema=0)
Initializes a file to be written.
stepw::sample::WriteAssembly_BasicExternalReferences
DtkErrorStatus WriteAssembly_BasicExternalReferences(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:612
stepw::sample::WritePart_BodyOnly
DtkErrorStatus WritePart_BodyOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:77
stepw_SetModeFdt
DtkErrorStatus stepw_SetModeFdt(const int inMode, const int inPolyline=2)
Activates/Deactivates writing of FDT.
stepw::sample::Write_MinimumViableFile
DtkErrorStatus Write_MinimumViableFile(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:52
stepw::sample::WritePart_BodyInNamedLayer
DtkErrorStatus WritePart_BodyInNamedLayer(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:357
stepw::sample::WritePart_Datum
DtkErrorStatus WritePart_Datum(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:231
stepw::sample::WriteAssembly_InstanceAttributes
DtkErrorStatus WriteAssembly_InstanceAttributes(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:570
stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT
DtkErrorStatus WriteAssembly_BasicExternalReference_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:693
stepw_EndFile
DtkErrorStatus stepw_EndFile()
Ends the writing of the current STEP file.
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
stepw::sample::Write_UserDefinedHeader
DtkErrorStatus Write_UserDefinedHeader(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:63
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
stepw::sample::WritePart_UsedByExternalAssembly
DtkErrorStatus WritePart_UsedByExternalAssembly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:330
stepw::sample::WriteAssembly_WithProperties
DtkErrorStatus WriteAssembly_WithProperties(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:516
stepw::sample::WritePart_GeometricalTolerance
DtkErrorStatus WritePart_GeometricalTolerance(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:279
stepw::sample::WriteAssembly_NestedExternalReferences
DtkErrorStatus WriteAssembly_NestedExternalReferences(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:651
stepw::sample::WritePart_BodyAndMeshFromTessellation
DtkErrorStatus WritePart_BodyAndMeshFromTessellation(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:170
stepw::sample::WritePart_WithProperties
DtkErrorStatus WritePart_WithProperties(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:195
stepw::sample::WriteAssembly
DtkErrorStatus WriteAssembly(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:390
stepw::sample::WriteAssembly_DimensionFDT
DtkErrorStatus WriteAssembly_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:429
stepw::sample::WritePart_MeshWithFaceColors
DtkErrorStatus WritePart_MeshWithFaceColors(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:150