IFC 图纸

导出 IFC 格式为 PNG

Aspose.CAD for .NET 允许开发者将 IFC 文件导出为 PNG。以下是演示如何访问 IFC 文件并使用 CadRasterizationOptionsPngOptions 将其转换为 PNG 的代码。

示例代码

//Setfile name path as other examples
string MyDir = RunExamples.GetDataDir_ConvertingCAD();
string sourceFilePath = MyDir + "example.ifc";
using (IfcImage cadImage = (IfcImage)Image.Load(sourceFilePath))
{
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = 100;
rasterizationOptions.PageHeight = 100;
PngOptions pngOptions = new PngOptions();
pngOptions.VectorRasterizationOptions = rasterizationOptions;
//Set output path as well
string outPath = sourceFilePath + ".png";
cadImage.Save(outPath, pngOptions);
}
}