DATAKIT SDK  V2026.3
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 ()
 
void stepw::sample::CreateTransforms (Dtk_transfo &outFirst, Dtk_transfo &outSecond, Dtk_transfo &outThird, Dtk_transfo &outFourth)
 
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_InstanceOverride (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)
821 {
822  Dtk_string outputFileName, outputDirectory;
823 
824  std::cout << endl << "----------------------------------------------" << std::endl;
825  std::cout << "Step Write start" << std::endl;
826 
827  stepw_SetModeProp( 3 );
828  stepw_SetModeFdt( 1 );
829 
830  // Choosing output directory and file name
831  outputDirectory = inResultDirectory + L"Step/";
832  outputDirectory.FixPathSeparator();
833  outputDirectory.mkdir();
834 
835  // First, initialize the Step writer
836  //int codeForAP203 = 1;
837  int codeForAP214 = 2;
838  //int codeForAP203E2 = 3;
839  int codeForAP242 = 4;
840  int dummy;
841  {
842  outputFileName = outputDirectory + L"SampleMinimumProduct.step";
843  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
844  PRINT_ERROR( stepw::sample::Write_MinimumViableFile( L"SampleMinimumProduct", dummy ) );
846  std::cout << "=> " << outputFileName.c_str() << std::endl;
847  }
848  //[...]
849  //end_of_mainstepwrite
850  {
851  outputFileName = outputDirectory + L"SampleMinimumProduct_UserDefinedHeader.step";
852  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
853  stepw::sample::Write_UserDefinedHeader( L"SampleMinimumProduct_UserDefinedHeader", dummy );
855  std::cout << "=> " << outputFileName.c_str() << std::endl;
856  }
857  {
858  outputFileName = outputDirectory + L"SamplePart_BodyOnly.step";
859  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
860  stepw::sample::WritePart_BodyOnly( L"SamplePart_BodyOnly", dummy );
862  std::cout << "=> " << outputFileName.c_str() << std::endl;
863  }
864  {
865  outputFileName = outputDirectory + L"SamplePart_BodyWithAxisSystem.step";
866  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
867  stepw::sample::WritePart_BodyWithAxisSystem( L"SamplePart_BodyWithAxisSystem", dummy );
869  std::cout << "=> " << outputFileName.c_str() << std::endl;
870  }
871  {
872  outputFileName = outputDirectory + L"SamplePart_WireframeOnly.step";
873  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
874  stepw::sample::WritePart_WireframeOnly( L"SamplePart_WireframeOnly", dummy );
876  std::cout << "=> " << outputFileName.c_str() << std::endl;
877  }
878  {
879  outputFileName = outputDirectory + L"SamplePart_MeshOnly.step";
880  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
881  stepw::sample::WritePart_MeshOnly( L"SamplePart_MeshOnly", dummy );
883  std::cout << "=> " << outputFileName.c_str() << std::endl;
884  }
885  {
886  outputFileName = outputDirectory + L"SamplePart_MeshWithFaceColors.step";
887  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
888  stepw::sample::WritePart_MeshWithFaceColors( L"SamplePart_MeshWithFaceColors", dummy );
890  std::cout << "=> " << outputFileName.c_str() << std::endl;
891  }
892  {
893  outputFileName = outputDirectory + L"SamplePart_BodyAndMeshFromTessellation.step";
894  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
895  stepw::sample::WritePart_BodyAndMeshFromTessellation( L"SamplePart_BodyAndMeshFromTessellation", dummy );
897  std::cout << "=> " << outputFileName.c_str() << std::endl;
898  }
899  {
900  outputFileName = outputDirectory + L"SamplePart_WithProperties.step";
901  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
902  stepw::sample::WritePart_WithProperties( L"SamplePart_WithProperties", dummy );
904  std::cout << "=> " << outputFileName.c_str() << std::endl;
905  }
906  {
907  outputFileName = outputDirectory + L"SamplePart_BodyInNamedLayer.step";
908  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
909  stepw::sample::WritePart_BodyInNamedLayer( L"SamplePart_BodyInNamedLayer", dummy );
911  std::cout << "=> " << outputFileName.c_str() << std::endl;
912  }
913  {
914  outputFileName = outputDirectory + L"SamplePart_Datum.step";
915  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
916  stepw::sample::WritePart_Datum( L"SamplePart_Datum", dummy );
918  std::cout << "=> " << outputFileName.c_str() << std::endl;
919  }
920  {
921  outputFileName = outputDirectory + L"SamplePart_GeometricalTolerance.step";
922  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
923  stepw::sample::WritePart_GeometricalTolerance( L"SamplePart_GeometricalTolerance", dummy );
925  std::cout << "=> " << outputFileName.c_str() << std::endl;
926  }
927  {
928  outputFileName = outputDirectory + L"SamplePart_UsedByExternalAssembly.step";
929  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
930  stepw::sample::WritePart_UsedByExternalAssembly( L"SamplePart_UsedByExternalAssembly", dummy );
932  std::cout << "=> " << outputFileName.c_str() << std::endl;
933  }
934  {
935  outputFileName = outputDirectory + L"SampleAssembly.step";
936  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
937  stepw::sample::WriteAssembly( L"SampleAssembly" );
939  std::cout << "=> " << outputFileName.c_str() << std::endl;
940  }
941  {
942  outputFileName = outputDirectory + L"SampleAssembly_InstanceOverride.step";
943  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
944  stepw::sample::WriteAssembly_InstanceOverride( L"SampleAssembly_InstanceOverride" );
946  std::cout << "=> " << outputFileName.c_str() << std::endl;
947  }
948  {
949  outputFileName = outputDirectory + L"SampleAssembly_DimensionFDT.step";
950  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
951  stepw::sample::WriteAssembly_DimensionFDT( L"SampleAssembly_DimensionFDT");
953  std::cout << "=> " << outputFileName.c_str() << std::endl;
954  }
955  {
956  outputFileName = outputDirectory + L"SampleAssembly_WithProperties.step";
957  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
958  stepw::sample::WriteAssembly_WithProperties( L"SampleAssembly_WithProperties");
960  std::cout << "=> " << outputFileName.c_str() << std::endl;
961  }
962  {
963  outputFileName = outputDirectory + L"SampleAssembly_InstanceAttributes.step";
964  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
965  stepw::sample::WriteAssembly_InstanceAttributes( L"SampleAssembly_InstanceAttributes" );
967  std::cout << "=> " << outputFileName.c_str() << std::endl;
968  }
969  {
970  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReferences.step";
971  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
972  stepw::sample::WriteAssembly_BasicExternalReferences( L"SampleAssembly_BasicExternalReferences");
974  std::cout << "=> " << outputFileName.c_str() << std::endl;
975  }
976  {
977  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReference_DimensionFDT.step";
978  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
979  stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT( L"SampleAssembly_BasicExternalReference_DimensionFDT");
981  std::cout << "=> " << outputFileName.c_str() << std::endl;
982  }
983  {
984  outputFileName = outputDirectory + L"SampleAssembly_NestedExternalReferences.step";
985  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
986  stepw::sample::WriteAssembly_NestedExternalReferences( L"SampleAssembly_NestedExternalReferences");
988  std::cout << "=> " << outputFileName.c_str() << std::endl;
989  }
990 
991  std::cout << "Step Write end" << std::endl;
992 
993  return 0;
994 }
stepw::sample::WritePart_MeshOnly
DtkErrorStatus WritePart_MeshOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:123
stepw::sample::WriteAssembly_InstanceOverride
DtkErrorStatus WriteAssembly_InstanceOverride(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:426
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:86
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:106
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:658
stepw::sample::WritePart_BodyOnly
DtkErrorStatus WritePart_BodyOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:68
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:43
stepw::sample::WritePart_BodyInNamedLayer
DtkErrorStatus WritePart_BodyInNamedLayer(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:354
stepw::sample::WritePart_Datum
DtkErrorStatus WritePart_Datum(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:228
stepw::sample::WriteAssembly_InstanceAttributes
DtkErrorStatus WriteAssembly_InstanceAttributes(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:616
stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT
DtkErrorStatus WriteAssembly_BasicExternalReference_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:739
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:54
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:327
stepw::sample::WriteAssembly_WithProperties
DtkErrorStatus WriteAssembly_WithProperties(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:562
stepw::sample::WritePart_GeometricalTolerance
DtkErrorStatus WritePart_GeometricalTolerance(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:276
stepw::sample::WriteAssembly_NestedExternalReferences
DtkErrorStatus WriteAssembly_NestedExternalReferences(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:697
stepw::sample::WritePart_BodyAndMeshFromTessellation
DtkErrorStatus WritePart_BodyAndMeshFromTessellation(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:161
stepw::sample::WritePart_WithProperties
DtkErrorStatus WritePart_WithProperties(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:186
stepw::sample::WriteAssembly
DtkErrorStatus WriteAssembly(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:387
stepw::sample::WriteAssembly_DimensionFDT
DtkErrorStatus WriteAssembly_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:476
stepw::sample::WritePart_MeshWithFaceColors
DtkErrorStatus WritePart_MeshWithFaceColors(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:141