3D Formats Conversion Via Python

Convert 3D document formats without any 3D modeling and rendering software to build cross-platform Python applications.

 

Developers can easily read, create, convert, update and control the substance of 3D formats easily using 3D graphics library. Few of the supported formats by the API are WavefrontOBJ, Discreet3DS, STL (ASCII, Binary), FBX (ASCII, Binary), Universal3D, Collada, GLB, glTF, PLY, DirectX, Google Draco formats and more. Conversion process is easily as to loading the source file via instance of Scene class , and calling the Save method with relevant output format parameter.

Convert 3D Scene to various formats

Developers can easily convert 3D scene through the same process listed above. Considering few examples such as FBX to OBJ conversion. Load the FBX file via Scene Class object. Create the saving options using ObjSaveOptions and call the scene Save method having output file path and obj options as parameters. API has appropriate options classes for saving into relevant classes like A3dwSaveOptions AmfSaveOptions Discreet3dsSaveOptions FbxSaveOptions Html5SaveOptions RvmSaveOptions and more. Here is complete list for 3D conversion format options. Moreover, developers can easily save a 3D scene into PDF.

C# Code for FBX to OBJ Conversion
from aspose.threed import Scene, FileFormat
# Load the FBX in an object of Scene
fbxtoObj = Scene("sourceTemplate.fbx");
# save FBX as a OBJ
fbxtoObj.save("csharp-fbx-to.obj", FileFormat.WAVEFRONT_OBJ);
C# Code for Converting 3D Scene into PDF
from aspose.threed import Scene
from aspose.threed.entities import Cylinder
from aspose.threed.shading import PhongMaterial
from aspose.threed.formats import PdfSaveOptions, PdfLightingScheme, PdfRenderMode
# Create a new scene
scene = Scene()
# Create a cylinder child node
cylinder = scene.root_node.create_child_node("cylinder", Cylinder())
cylinder.material = PhongMaterial()
# Set rendering mode and lighting scheme
opt = PdfSaveOptions()
opt.lighting_scheme = PdfLightingScheme.CAD
opt.render_mode = PdfRenderMode.SHADED_ILLUSTRATION
# Save in the PDF format
scene.save("output_out.pdf", opt)