Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Drawing2D Class / Export Method
Exported drawing format/type.
Path to the directory where you want to save the exported drawing file.
Custom name of the exported drawing file. If not provided the name of the drawing is used.
Example
In This Topic
    Export Method (Drawing2D)
    In This Topic
    Export this drawing to a file.
    Syntax

    Parameters

    exportDrawingType
    Exported drawing format/type.
    directoryPath
    Path to the directory where you want to save the exported drawing file.
    customDrawingName
    Custom name of the exported drawing file. If not provided the name of the drawing is used.
    Exceptions
    ExceptionDescription
    Argument is null.
    This directory was not found.
    Remarks
    This method does not use the 2D drawing file prefix/suffix as set in the Studio settings. If you want to include them in the name, prepend/append EPLAN.Harness.API.Settings.SExport.DrawingExchangeFilePrefix / EPLAN.Harness.API.Settings.SExport.DrawingExchangeFileSuffix yourself.
    Example
    The following example shows how to export nailboard to a file.
    // Variant was obtained before...
    Variant variant = ...
    
    // Select desired nailboard from the variant.
    Nailboard nailboard = variant.GetNailboards().First(n => n.Name == "SampleNailboard");
    
    // Opening of the nailboard is not required.
    // nailboard.Open(false, false);
    
    // Prepare folder where you want to store exported files.
    string directory = @"C:\ExportedDrawings\Nailboards";
    
    // Export the nailboard to PDF file with name taken from HpD project.
    nailboard.Export(ApiExportDrawingType.PDF, directory);
    
    // Export the nailboard to DXF file with name taken from HpD project.
    nailboard.Export(ApiExportDrawingType.DXF, directory);
    
    // Export the nailboard to PNG file with custom name.
    nailboard.Export(ApiExportDrawingType.PNG, directory, "PngNailboard");
    
    // Export the nailboard to JPG file with custom name.
    nailboard.Export(ApiExportDrawingType.JPEG, directory, "JpegNailboard.jpg");
    
    // If the nailboard is open, close it.
    // nailboard.Close();
    
    /* Content of the selected folder:
    *
    * C:\
    * |
    * -- ExportedDrawings\
    *    |
    *    -- Nailboards\
    *       |- JpegNailboard.jpg
    *       |- PngNailboard.png
    *       |- SampleNailboard.dxf
    *       -- SampleNailboard.pdf
    *
    */
    The following example shows how to export cable drawing to all supported formats.
    // Variant was obtained before...
    Variant variant = ...
    
    // Select desired cable drawing from the variant.
    CableDrawing cableDrawing = variant.GetCableDrawings().First(c => c.Name == "SampleCableDrawing");
    
    // Opening of the nailboard is not required.
    // cableDrawing.Open(false, false);
    
    // Prepare folder where you want to store exported files.
    string directory = @"C:\ExportedDrawings\CableDrawings";
    
    // Export the cable drawing to all supported formats with name taken from HpD project.
    foreach (ApiExportDrawingType format in Enum.GetValues(typeof(ApiExportDrawingType)))
    {
    	cableDrawing.Export(format, directory);
    }
    
    // If the cable drawing is open, close it.
    // cableDrawing.Close();
    
    /* Content of the selected folder:
    *
    * C:\
    * |
    * -- ExportedDrawings\
    *    |
    *    -- CableDrawings\
    *       |- SampleCableDrawing.bmp
    *       |- SampleCableDrawing.dwg
    *       |- SampleCableDrawing.dxf
    *       |- SampleCableDrawing.gif
    *       |- SampleCableDrawing.jpg
    *       |- SampleCableDrawing.pdf
    *       |- SampleCableDrawing.png
    *       |- SampleCableDrawing.ps
    *       |- SampleCableDrawing.svg
    *       -- SampleCableDrawing.tif
    *
    */
    See Also