Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / Export3DFile Method
Type of exported file.
Path to output directory.
Name of exported file (without extension)
Example
In This Topic
    Export3DFile Method
    In This Topic
    Export current 3D scene of workdesk or workspace to CAD file. The format of the file must be specified by its extension. Some options of the export are available in settings.
    Syntax

    Parameters

    exportType
    Type of exported file.
    directoryPath
    Path to output directory.
    fileName
    Name of exported file (without extension)
    Exceptions
    ExceptionDescription
    Argument is null.
    The exception that is thrown when the file has the wrong extension.
    Example
    Export a current 3D scene to STP file.
    // Initialize API.
    HpdApi api = HpdApi.GetInstance();
    api.Init();
    
    // Open project and document.
    Project project = api.OpenProject(@"D:\MyHpDproject.hxproj");
    Variant variant = project.GetVariants()[0];
    variant.Open(false, false);
    Workdesk workdesk = variant.GetWorkdesks()[0];
    // Alternatively select workdesk by name.
    // Workdesk workdesk = variant.GetWorkdesks().FirstOrDefault(w => w.Name == "Workdesk_1");
    workdesk.Open(false, false);
    
    // Modify setting to select which objects to export.
    DesignerExport exportSettings = workdesk.Settings.DataExchange.Export;
    exportSettings.CableTies = true;
    exportSettings.ExportBundles = true;
    exportSettings.ExportCS = true;
    exportSettings.ExportCables = true;
    exportSettings.ExportConnectors = true;
    exportSettings.ExportControlPoints = true;
    exportSettings.ExportLabels = true;
    exportSettings.ExportLeadingParts = true;
    exportSettings.ExportParts = true;
    exportSettings.ExportWires = true;
    // Save document to apply settings.
    workdesk.Save();
    
    // Set file format options (available for .jt and .stp).
    api.StudioSettings.DataExchange.Export.StepFormat = ApiStepExportFormat.AP203;
    api.StudioSettings.Save();
    
    // Export 3D file and close documents.
    workdesk.Export3DFile(ApiExport3DFileType.StepFile, @"e:\", api-test);
    
    workdesk.Close();
    variant.Close();
    project.Close();
    
    // Close the API.
    api.Close();
    See Also