c# Aspose.CAD 读取cad并存储为2010版
时间: 2023-08-02 18:18:04 浏览: 45
您可以使用以下 C# 代码来读取 CAD 文件并将其存储为 2010 版本:
```csharp
using (CadImage cadImage = (CadImage)Image.Load("input.dwg"))
{
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = cadImage.Width;
rasterizationOptions.PageHeight = cadImage.Height;
rasterizationOptions.AutomaticLayoutsScaling = true;
rasterizationOptions.ScaleMethod = ScaleType.GrowToFit;
rasterizationOptions.ContentAsBitmap = true;
rasterizationOptions.NoScaling = false;
rasterizationOptions.BackgroundColor = Color.White;
rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
rasterizationOptions.Zoom = 100;
DwgOptions dwgOptions = new DwgOptions();
dwgOptions.Version = DwgVersion.AutoCad2010;
cadImage.Save("output.dwg", dwgOptions);
}
```
请注意,您需要使用 Aspose.CAD 库来读取 CAD 文件,并且您需要将输入文件路径和输出文件路径指定为相应的参数。此外,您还可以根据需要调整 CAD 元素的呈现选项。