STL Drawings

Exporting STL Format To PNG

Aspose.CAD for .NET allows developers to export an STL file to PNG. Following is the code demonstrating how to access the STL file and convert that to PNG using CadRasterizationOption and PngOptions.

Sample Code

string MyDir = RunExamples.GetDataDir_ConvertingCAD();
string sourceFilePath = MyDir + "galeon.stl";
using (var cadImage = (CadImage)Image.Load(sourceFilePath))
{
var rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = 100;
rasterizationOptions.PageHeight = 100;
PngOptions pngOptions = new PngOptions();
pngOptions.VectorRasterizationOptions = rasterizationOptions;
string outPath = sourceFilePath + ".png";
cadImage.Save(outPath, pngOptions);
}
}