Export with 3D options
Export with 3D options
Few options were introduced to export 3D models to PDF/raster from corresponding FBX, OBJ, STL formats.
Here are the examples of the 3D scene from different viewpoints:
ObserverPoint property allows to rotate the 3D scene according to specified angles around axis. This example shows the code and export result using some arbitrary rotation angles.
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); | |
} |
Changing the ObserverAngle to ObserverPoint = new ObserverPoint(5, 60, 0) allows to rotate the scene.
The other RenderMode3D property allows to specify how export result should be presented. There are 3 modes: Solid (the default), Wireframe, and SolidWithEdges.
The example below allows to create wireframe model for the spherical object.
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); | |
} |
The example below shows the difference between Solid and SolidWithEdges modes.