ImageGear .NET v25.2 - Updated
CAD to Stacked SVG
Developer Guide > How to Work with... > CAD > How To ... > Convert ... > CAD to Stacked SVG

The following CADtoStackedSVG sample illustrates how you can create a stacked SVG from a CAD page:

C#
Copy Code
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;

public static void CadToStackedSvg(string inFile, string outFile)
{
    ImGearCADPage page = null;

    // Load the file.
    using (FileStream fileStream = new FileStream(inFile, FileMode.Open, FileAccess.Read))
    {
        page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
    }

    // Save the CAD file to a Stacked SVG file.
    page.SaveOptions["StackedSVG"] = true;

    using (FileStream fileStream = new FileStream(outFile, FileMode.Create, FileAccess.Write))
    {
        ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.SVG);
    }
}
VB.NET
Copy Code
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD

Public Sub CadToStackedSvg(inPath As String, outPath As String)
    Dim page As ImGearCADPage

    ' Load the file.
    Using fileStream As New FileStream(inPath, FileMode.Open, FileAccess.Read)
        page = ImGearFileFormats.LoadPage(fileStream)
    End Using

    ' Save the CAD file as a Stacked SVG file
    page.SaveOptions.Add("StackedSVG", True)

    Using fileStream As New FileStream(outPath, FileMode.Create, FileAccess.Write)
        ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.SVG)
    End Using
End Sub

 

Is this page helpful?
Yes No
Thanks for your feedback.