带有 3D 选项的导出
Contents
[
Hide
]带有 3D 选项的导出
引入了一些选项,以将 3D 模型从相应的 FBX、OBJ、STL 格式导出为 PDF/栅格。
以下是从不同视角看到的 3D 场景示例:
ObserverPoint 属性允许根据指定的角度围绕轴旋转 3D 场景。这个示例展示了使用一些任意旋转角度的代码和导出结果。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (Image cadImage = Aspose.CAD.Image.Load(inputFileName)) | |
{ | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions() | |
{ | |
PageWidth = 5000, | |
PageHeight = 5000, | |
DrawType = CadDrawTypeMode.UseObjectColor, | |
ObserverPoint = new ObserverPoint(15, 5, 5), | |
}; | |
PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions(); | |
pdfOptions.VectorRasterizationOptions = rasterizationOptions; | |
cadImage.Save(outputFileName, pdfOptions); | |
} |
将 ObserverAngle 更改为 ObserverPoint = new ObserverPoint(5, 60, 0) 允许旋转场景。
另一个 RenderMode3D 属性允许指定导出结果应如何呈现。有 3 种模式:实心(默认)、线框和带边缘的实心。
下面的示例允许为球形对象创建线框模型。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (Image cadImage = Aspose.CAD.Image.Load(fileName)) | |
{ | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions() | |
{ | |
PageWidth = 5000, | |
PageHeight = 5000, | |
DrawType = CadDrawTypeMode.UseObjectColor, | |
RenderMode3D = RenderMode3D.Wireframe | |
}; | |
PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions(); | |
pdfOptions.VectorRasterizationOptions = rasterizationOptions; | |
cadImage.Save(outputFileName, pdfOptions); | |
} |
下面的示例显示了实心模式和带边缘的实心模式之间的差异。