File Controller

interface ICwAPI3DFileController

Public Functions

virtual ICwAPI3DString *getLastError(int32_t *aErrorCode) = 0

Gets the last error.

Parameters:

aErrorCode[out] [int32_t*] The error code.

Returns:

[ICwAPI3DString*] The error string.

virtual void exportSTLFile(ICwAPI3DElementIDList *aElementIDList, const character *aFilePath) = 0

Exports an STL file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.stl";

aFactory.getFileController()->exportSTLFile(selectedElements, outputPath);

Parameters:
virtual ICwAPI3DElementIDList *importStepFile(const character *aFilePath, double aScaleFactor) = 0

Imports a STEP file.

Parameters:
  • aFilePath[in] [const character*] The input file path.

  • aScaleFactor[in] [double] The file scale factor.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual ICwAPI3DElementIDList *importStepFileWithMessageOption(const character *aFilePath, double aScaleFactor, bool aHideMessage) = 0

Imports a STEP file with message option.

Parameters:
  • aFilePath[in] [const character*] The input file path.

  • aScaleFactor[in] [double] The file scale factor.

  • aHideMessage[in] [bool] Hide message.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual bool exportWebGl(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath) = 0

Exports a WebGL file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.html";

bool success = aFactory.getFileController()->exportWebGL(selectedElements, outputPath);
if (success) {
    printf("WebGL export completed successfully\n");
}

Parameters:
Returns:

[bool] True on successful export, false otherwise.

virtual bool export3dFile(ICwAPI3DElementIDList *aElementIdList, const CwAPI3D::character *aFilePath) = 0

Exports a 3D file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.3d";
bool success = aFactory.getFileController()->export3DFile(selectedElements, outputPath);
if (success) {
    printf("3D file export completed successfully\n");
}

Parameters:
Returns:

[bool] True on successful export, false otherwise.

virtual ICwAPI3DElementIDList *importSATFile(const character *aFilePath, double aScaleFactor, bool aBinary) = 0

Imports an SAT file.

Parameters:
  • aFilePath[in] [const character*] The input file path.

  • aScaleFactor[in] [double] The scale factor.

  • aBinary[in] [bool] Is the import file binary.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual ICwAPI3DElementIDList *import3dcFile(const character *aFilePath) = 0

Imports a 3DC file.

Parameters:

aFilePath[in] [const character*] The input file path.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual ICwAPI3DElementIDList *importRhinoFile(const character *aFilePath, bool aWithoutDialog) = 0

Imports a Rhino file.

Parameters:
  • aFilePath[in] [const character*] The input file path.

  • aWithoutDialog[in] [bool] Import without dialog?

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual void exportStepFile(ICwAPI3DElementIDList *aElementList, const character *aFilePath, double aScaleFactor, int32_t aVersion, bool aTextMode) = 0

Exports a STEP file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.stp";
double scaleFactor = 1000.0;
int version = 214;       // STEP version
bool textMode = false;

aFactory.getFileController()->exportSTEPFile(selectedElements, outputPath, scaleFactor, version, textMode);

Parameters:
  • aElementList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aScaleFactor[in] [double] The file scale factor.

  • aVersion[in] The file export version :

    • 214 = STEP AP214

    • 203 = STEP AP203 (default value)

  • aTextMode[in] [bool] Use text mode. PARAMETER UNUSED

virtual void import3DZFile(const character *aFilePath) = 0

Imports a 3DZ file.

Parameters:

aFilePath[in] [const character*] The input file path.

virtual void exportOBJFile(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath) = 0

Exports a OBJ file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.obj";

aFactory.getFileController()->exportOBJFile(selectedElements, outputPath);

Parameters:
virtual ICwAPI3DElementIDList *importSATFileSilently(const character *aFilePath, double aScaleFactor, bool aBinary) = 0

Imports a SAT File without messages.

Parameters:
  • aFilePath[in] [const character*] The input file path.

  • aScaleFactor[in] [double] The scale factor.

  • aBinary[in] [bool] Is the import file binary.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual void exportFBXFile(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath, uint32_t aFBXFormat) = 0

Exports a FBX file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.fbx";

// FBX binary format
int fbxFormat = 1;
aFactory.getFileController()->exportFBXFile(selectedElements, outputPath, fbxFormat);

// Export as ASCII format
fbxFormat = 2; // FBX ASCII format
aFactory.getFileController()->exportFBXFile(selectedElements, outputPath, fbxFormat);

Parameters:
  • aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aFBXFormat[in] [uint32_t] The FBX format. Available values :

    • 1 = “FBX binary(*.fbx)”;

    • 2 = “FBX ascii(*.fbx)”;

    • 3 = “FBX encrypted(*.fbx)”;

    • 4 = “FBX 6.0 binary(*.fbx)”;

    • 5 = “FBX 6.0 ascii(*.fbx)”;

    • 6 = “FBX 6.0 encrypted(*.fbx)”;

virtual void clearErrors() = 0

Clears all errors.

virtual ICwAPI3DElementIDList *import3dcFileWithGlide(const character *aFilePath) = 0

Imports a 3DC file with glide.

Parameters:

aFilePath[in] [const character*] The input file path.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual void importBTLFile(const character *aFilePath) = 0

Imports a BTL file.

Parameters:

aFilePath[in] [const character*] The input file path.

virtual void export3DCFile(ICwAPI3DElementIDList *aElementIdList, const CwAPI3D::character *aFilePath) = 0

Exports a 3D file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.3dc";
aFactory.getFileController()->export3DCFile(selectedElements, outputPath);

Parameters:
virtual void importBTLFileForNesting(const character *aFilePath) = 0

Imports a BTL file for nesting.

Parameters:

aFilePath[in] [const character*] The input file path.

virtual void exportBTLFileForNesting(const character *aFilePath) = 0

Exports a BTL file for nesting.

Example:
const character* outputPath = L"C:/exports/nesting_project.btl";
aFactory.getFileController()->exportBTLFileForNesting(outputPath);

Parameters:

aFilePath[in] [const character*] The output file path.

virtual void exportRhinoFile(ICwAPI3DElementIDList *aElementIdList, const CwAPI3D::character *aFilePath, int aVersion, bool aUseDefaultAssignment, bool aWriteStandardAttributes) = 0

Exports a 3dm rhino file.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.3dm";
int version = 8;                       // Rhino version
bool useDefaultAssignment = true;     // Use default Rhino layer assignment
bool writeStandardAttributes = false; // Do not write standard attributes

aFactory.getFileController()->exportRhinoFile(selectedElements, outputPath, version, useDefaultAssignment, writeStandardAttributes);

Parameters:
  • aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aVersion[in] [int] The rhino version :

    • 5 = V5.0,

    • 6 = V6.0,

    • 7 = V7.0,

    • 8 = V8.0

  • aUseDefaultAssignment[in] [bool] True if default assignment is used. False if no attributes are exported.

  • aWriteStandardAttributes[in] [bool] True if exported with standard attribute, false otherwise.

virtual ICwAPI3DElementIDList *importBXFFile(const CwAPI3D::character *aFilePath, CwAPI3D::vector3D aInsertPosition) = 0

Imports a BXF file.

Parameters:
  • aFilePath[in] [const character*] The import file path.

  • aInsertPosition[in] [vector3D] The position where the imported elements will be inserted.

Returns:

[ICwAPI3DElementIDList*] The list of IDs of the imported elements.

virtual ICwAPI3DString *getBlumExportPath() = 0

Gets the path of the Blum export.

Returns:

[ICwAPI3DString*] The path of the Blum export.

virtual void setBlumExportPath(const CwAPI3D::character *aPath) = 0

Sets the path of the Blum export.

Parameters:

aPath[in] [const character*] The new path for the Blum export.

virtual void setWebGLHierarchy(uint32_t aStage, ICwAPI3DDisplayAttribute *aAttribute) = 0

Sets the webGL Export hierachy.

Deprecated:

Will be deleted in the future.

virtual void exportSATFile(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath, double aScaleFactor, bool aBinary, int32_t aVersion) = 0

Exports a SAT File.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.sat";
double scaleFactor = 1.0;
bool binaryFormat = true;
int version = 25000; // SAT version

aFactory.getFileController()->exportSATFile(selectedElements, outputPath, scaleFactor, binaryFormat, version);

Parameters:
  • aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aScaleFactor[in] [double] The file scale factor.

  • aBinary[in] [bool] Whether to write the SAT file in binary or a human readable format.

  • aVersion[in] [int32_t] The ACIS version to use :

    • 3400 = v34.0

    • 3200 = v32.0

    • 2100 = v21.0

virtual void exportGLBFile(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath) = 0

Exports a GLB File.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.glb";

aFactory.getFileController()->exportGLBFile(selectedElements, outputPath);

Parameters:
virtual ICwAPI3DElementIDList *importVariantFile(const character *aFilePath, CwAPI3D::vector3D aInsertPosition) = 0

Imports a variant (.val-File).

Parameters:
  • aFilePath[in] [const character*] The import file path.

  • aInsertPosition[in] [vector3D] The position where the imported variant elements will be inserted.

Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual elementID importElementLight(const character *aFilePath, CwAPI3D::vector3D aInsertPosition) = 0

Imports a light element from a file.

Parameters:
  • aFilePath[in] [const character*] The import file path.

  • aInsertPosition[in] [vector3D] The position where the imported light element will be inserted.

Returns:

[elementID] The ID of the imported light element.

virtual void exportRhinoFileWithOptions(ICwAPI3DElementIDList *aElementIdList, const CwAPI3D::character *aFilePath, int aVersion, bool aUseDefaultAssignment, bool aWriteStandardAttributes, ICwAPI3DRhinoOptions *aRhinoOptions) = 0

Exports elements to a rhino 3dm file based on the export options.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model.3dm";
int version = 8;                       // Rhino version
bool useDefaultAssignment = true;     // Use default Rhino layer assignment
bool writeStandardAttributes = false; // Do not write standard attributes
ICwAPI3DRhinoExportOptions rhinoOptions; // Use default options

aFactory.getFileController()->exportRhinoFileWithOptions(selectedElements, outputPath, version, useDefaultAssignment, writeStandardAttributes, &rhinoOptions);

Parameters:
  • aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aVersion[in] [int] The rhino version :

    • 5 = V5.0,

    • 6 = V6.0,

    • 7 = V7.0,

    • 8 = V8.0

  • aUseDefaultAssignment[in] [bool] True if default assignment is used. False if no attributes are exported.

  • aWriteStandardAttributes[in] [bool] True if exported with standard attribute, false otherwise.

  • aRhinoOptions[in] [ICwAPI3DRhinoOptions*] The Rhino export option.

virtual ICwAPI3DElementIDList *import3dcFileWithOptions(const character *aFilePath, ICwAPI3DImport3dcOptions *aImport3dcOptions) = 0

Imports a 3d or a 3dc file depending on the import options.

Parameters:
Returns:

[ICwAPI3DElementIDList*] The imported list of element id.

virtual void loadWebGlPresetFile(const character *aFilePath) = 0

Loads a preset file for the WebGl export.

Parameters:

aFilePath[in] [const character*] The preset file path.

virtual void exportStepFileExtrudeDrillings(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath, double aScaleFactor, int32_t aVersion, bool aTextMode, bool aImperialUnits) = 0

Exports a STEP file with extruded drillings.

Example:
ICwAPI3DElementIDList* selectedElements = aFactory.getElementController()->getAllIdentifiableElementIDs();
const character* outputPath = L"C:/exports/model_with_drillings.step";
double scaleFactor = 1.0;
int version = 214;         // STEP version
bool textMode = false;
bool imperialUnits = false;

aFactory.getFileController()->exportSTEPFileExtrudeDrillings(selectedElements, outputPath, scaleFactor, version, textMode, imperialUnits);

Parameters:
  • aElementList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aScaleFactor[in] [double] The file scale factor.

  • aVersion[in] The file export version :

    • 214 = STEP AP214

    • 203 = STEP AP203 (default value)

  • aTextMode[in] [bool] Use text mode. PARAMETER UNUSED

  • aImperialUnits[in] [bool] Use imperial units.

virtual void exportSATFileCutDrillings(ICwAPI3DElementIDList *aElementIdList, const character *aFilePath, double aScaleFactor, bool aBinary, int32_t aVersion) = 0

Exports a SAT File with extruded drillings (cut drilling holes into bodies).

Parameters:
  • aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

  • aFilePath[in] [const character*] The output file path.

  • aScaleFactor[in] [double] The file scale factor.

  • aBinary[in] [bool] Whether to write the SAT file in binary or a human readable format.

  • aVersion[in] [int32_t] The ACIS version to use :

    • 3400 = v34.0

    • 3200 = v32.0

    • 2100 = v21.0

virtual bimTeamUploadResult uploadToBimTeamAndCreateShareLink(Interfaces::ICwAPI3DElementIDList *aElementIdList) = 0

Exports the elements to BIMteam and creates a share link.

Parameters:

aElementIdList[in] [ICwAPI3DElementIDList*] The list of element id to export.

Returns:

[bimTeamUploadResult] a result object with a result code and a share link. If the code is not ok (0), the share link string is empty.

virtual bool exportDxfFile(const character *aFilePath, DxfLayerFormatType aDxfLayerFormatType, DxfExportVersion aDxfExportVersion) = 0

Exports visible elements in the scene to a DXF file.

Parameters:
  • aFilePath[in] [const character*] The output file path.

  • aDxfLayerFormatType[in] [DxfLayerFormatType] The format type of how to organize layers.

  • aDxfExportVersion[in] [DxfExportVersion] The dxf version to use for the export.

Returns:

[bool] True on successful export, false otherwise.

virtual bool exportDstvFile(const CwAPI3D::character *aFilePath) = 0

Exports active elements in the scene to a DSTV (.stp) file.

Parameters:

aFilePath[in] [const character*] The output file path.

Returns:

[bool] True on successful export, false otherwise.