The CADViewer demo demonstrates this functionality. See Samples.
The following CADtoSVG sample illustrates how you can create a SVG page from a CAD page:
C# |
Copy Code |
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;
public static void CadToImage(string inPath, string outPath)
{
ImGearCADPage page = null;
// Load file.
using (FileStream fileStream = new FileStream(inPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
page = ImGearFileFormats.LoadPage(fileStream, 0);
}
// Save a CAD file to a PNG image
ImGearSavingFormats formatOut = ImGearSavingFormats.SVG;
using (FileStream fileStream = new FileStream(outPath, FileMode.Create, FileAccess.Write, FileShare.Read))
{
ImGearFileFormats.SavePage(page, fileStream, formatOut);
}
} |
VB.NET |
Copy Code |
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD
Public Sub CadToImage(inPath As String, outPath As String)
Dim page as ImGearCADPage
' Load file.
Using fileStream as FileStream = New FileStream(inPath, FileMode.Open, FileAccess.Read, FileShare.Read))
page = ImGearFileFormats.LoadPage(fileStream, 0)
End Using
' Save a CAD file to a PNG image
Dim formatOut As ImGearSavingFormats = ImGearSavingFormats.SVG
Using fileStream as FileStream = New FileStream(outPath, FileMode.Create, FileAccess.Write, FileShare.Read))
ImGearFileFormats.SavePage(page, fileStream, formatOut)
End Using
End Sub |
Any conversions made to the CADPage’s camera will reflect in the saved SVG file.