DATAKIT API  V2025.4
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::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)
754 {
755  Dtk_string outputFileName, outputDirectory;
756 
757  std::cout << endl << "----------------------------------------------" << std::endl;
758  std::cout << "Step Write start" << std::endl;
759 
760  stepw_SetModeProp( 3 );
761  stepw_SetModeFdt( 1 );
762 
763  // Choosing output directory and file name
764  outputDirectory = inResultDirectory + L"Step/";
765  outputDirectory.FixPathSeparator();
766  outputDirectory.mkdir();
767 
768  // First, initialize the Step writer
769  //int codeForAP203 = 1;
770  int codeForAP214 = 2;
771  //int codeForAP203E2 = 3;
772  int codeForAP242 = 4;
773  int dummy;
774 
775  {
776  outputFileName = outputDirectory + L"SamplePart_BodyOnly.step";
777  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
778  stepw::sample::WritePart_BodyOnly( L"SamplePart_BodyOnly", dummy );
780  std::cout << "=> " << outputFileName.c_str() << std::endl;
781  }
782  //[...]
783  //end_of_mainstepwrite
784  {
785  outputFileName = outputDirectory + L"SamplePart_BodyWithAxisSystem.step";
786  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
787  stepw::sample::WritePart_BodyWithAxisSystem( L"SamplePart_BodyWithAxisSystem", dummy );
789  std::cout << "=> " << outputFileName.c_str() << std::endl;
790  }
791  {
792  outputFileName = outputDirectory + L"SamplePart_WireframeOnly.step";
793  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
794  stepw::sample::WritePart_WireframeOnly( L"SamplePart_WireframeOnly", dummy );
796  std::cout << "=> " << outputFileName.c_str() << std::endl;
797  }
798  {
799  outputFileName = outputDirectory + L"SamplePart_MeshOnly.step";
800  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
801  stepw::sample::WritePart_MeshOnly( L"SamplePart_MeshOnly", dummy );
803  std::cout << "=> " << outputFileName.c_str() << std::endl;
804  }
805  {
806  outputFileName = outputDirectory + L"SamplePart_MeshWithFaceColors.step";
807  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
808  stepw::sample::WritePart_MeshWithFaceColors( L"SamplePart_MeshWithFaceColors", dummy );
810  std::cout << "=> " << outputFileName.c_str() << std::endl;
811  }
812  {
813  outputFileName = outputDirectory + L"SamplePart_BodyAndMeshFromTessellation.step";
814  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
815  stepw::sample::WritePart_BodyAndMeshFromTessellation( L"SamplePart_BodyAndMeshFromTessellation", dummy );
817  std::cout << "=> " << outputFileName.c_str() << std::endl;
818  }
819  {
820  outputFileName = outputDirectory + L"SamplePart_WithProperties.step";
821  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP214 ) );
822  stepw::sample::WritePart_WithProperties( L"SamplePart_WithProperties", dummy );
824  std::cout << "=> " << outputFileName.c_str() << std::endl;
825  }
826  {
827  outputFileName = outputDirectory + L"SamplePart_BodyInNamedLayer.step";
828  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
829  stepw::sample::WritePart_BodyInNamedLayer( L"SamplePart_BodyInNamedLayer", dummy );
831  std::cout << "=> " << outputFileName.c_str() << std::endl;
832  }
833  {
834  outputFileName = outputDirectory + L"SamplePart_Datum.step";
835  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
836  stepw::sample::WritePart_Datum( L"SamplePart_Datum", dummy );
838  std::cout << "=> " << outputFileName.c_str() << std::endl;
839  }
840  {
841  outputFileName = outputDirectory + L"SamplePart_GeometricalTolerance.step";
842  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
843  stepw::sample::WritePart_GeometricalTolerance( L"SamplePart_GeometricalTolerance", dummy );
845  std::cout << "=> " << outputFileName.c_str() << std::endl;
846  }
847  {
848  outputFileName = outputDirectory + L"SamplePart_UsedByExternalAssembly.step";
849  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
850  stepw::sample::WritePart_UsedByExternalAssembly( L"SamplePart_UsedByExternalAssembly", dummy );
852  std::cout << "=> " << outputFileName.c_str() << std::endl;
853  }
854  {
855  outputFileName = outputDirectory + L"SampleAssembly.step";
856  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
857  stepw::sample::WriteAssembly( L"SampleAssembly" );
859  std::cout << "=> " << outputFileName.c_str() << std::endl;
860  }
861  {
862  outputFileName = outputDirectory + L"SampleAssembly_DimensionFDT.step";
863  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
864  stepw::sample::WriteAssembly_DimensionFDT( L"SampleAssembly_DimensionFDT");
866  std::cout << "=> " << outputFileName.c_str() << std::endl;
867  }
868  {
869  outputFileName = outputDirectory + L"SampleAssembly_WithProperties.step";
870  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
871  stepw::sample::WriteAssembly_WithProperties( L"SampleAssembly_WithProperties");
873  std::cout << "=> " << outputFileName.c_str() << std::endl;
874  }
875  {
876  outputFileName = outputDirectory + L"SampleAssembly_InstanceAttributes.step";
877  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
878  stepw::sample::WriteAssembly_InstanceAttributes( L"SampleAssembly_InstanceAttributes" );
880  std::cout << "=> " << outputFileName.c_str() << std::endl;
881  }
882  {
883  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReferences.step";
884  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
885  stepw::sample::WriteAssembly_BasicExternalReferences( L"SampleAssembly_BasicExternalReferences");
887  std::cout << "=> " << outputFileName.c_str() << std::endl;
888  }
889  {
890  outputFileName = outputDirectory + L"SampleAssembly_BasicExternalReference_DimensionFDT.step";
891  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
892  stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT( L"SampleAssembly_BasicExternalReference_DimensionFDT");
894  std::cout << "=> " << outputFileName.c_str() << std::endl;
895  }
896  {
897  outputFileName = outputDirectory + L"SampleAssembly_NestedExternalReferences.step";
898  PRINT_ERROR( stepw_InitFile( outputFileName, " sample ", codeForAP242 ) );
899  stepw::sample::WriteAssembly_NestedExternalReferences( L"SampleAssembly_NestedExternalReferences");
901  std::cout << "=> " << outputFileName.c_str() << std::endl;
902  }
903 
904  std::cout << "Step Write end" << std::endl;
905 
906  return 0;
907 }
stepw::sample::WritePart_MeshOnly
DtkErrorStatus WritePart_MeshOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:111
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
stepw::sample::WritePart_BodyWithAxisSystem
DtkErrorStatus WritePart_BodyWithAxisSystem(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:74
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:94
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:591
stepw::sample::WritePart_BodyOnly
DtkErrorStatus WritePart_BodyOnly(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:56
stepw_SetModeFdt
DtkErrorStatus stepw_SetModeFdt(const int inMode, const int inPolyline=2)
Activates/Deactivates writing of FDT.
stepw::sample::WritePart_BodyInNamedLayer
DtkErrorStatus WritePart_BodyInNamedLayer(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:336
stepw::sample::WritePart_Datum
DtkErrorStatus WritePart_Datum(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:210
stepw::sample::WriteAssembly_InstanceAttributes
DtkErrorStatus WriteAssembly_InstanceAttributes(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:549
stepw::sample::WriteAssembly_BasicExternalReference_DimensionFDT
DtkErrorStatus WriteAssembly_BasicExternalReference_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:672
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.
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:309
stepw::sample::WriteAssembly_WithProperties
DtkErrorStatus WriteAssembly_WithProperties(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:495
stepw::sample::WritePart_GeometricalTolerance
DtkErrorStatus WritePart_GeometricalTolerance(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:258
stepw::sample::WriteAssembly_NestedExternalReferences
DtkErrorStatus WriteAssembly_NestedExternalReferences(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:630
stepw::sample::WritePart_BodyAndMeshFromTessellation
DtkErrorStatus WritePart_BodyAndMeshFromTessellation(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:149
stepw::sample::WritePart_WithProperties
DtkErrorStatus WritePart_WithProperties(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:174
stepw::sample::WriteAssembly
DtkErrorStatus WriteAssembly(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:369
stepw::sample::WriteAssembly_DimensionFDT
DtkErrorStatus WriteAssembly_DimensionFDT(const Dtk_string &inRootAssemblyName)
Definition: testlibstepwrite.cpp:408
stepw::sample::WritePart_MeshWithFaceColors
DtkErrorStatus WritePart_MeshWithFaceColors(const Dtk_string &inPartName, int &outPartID)
Definition: testlibstepwrite.cpp:129