Introduction
Aspose.3D FOSS for Python is a pure-Python library for reading and writing 3D scene files. It is published on PyPI as aspose-3d-foss, carries an MIT license, and has zero external runtime dependencies.
Every format the library handles is translated into the same Scene object on load, and serialized back out from that same object on save. This means code that walks a scene graph, inspects mesh data, or applies materials is written once and works regardless of which file format it started from or is being written to.
This post walks through each format Aspose.3D FOSS for Python supports — what it can read, what it can write, and which load/save option classes control the details — so you know exactly what to expect before you build a conversion or inspection pipeline around it.
What’s Included
OBJ
Wavefront OBJ is a widely supported static-mesh interchange format. The library reads vertex positions, polygon faces, and the companion .mtl material file when present, controlled through ObjLoadOptions.
from aspose.threed import Scene
from aspose.threed.formats.obj import ObjLoadOptions
scene = Scene()
options = ObjLoadOptions()
options.enable_materials = True
scene.open("model.obj", options)
for node in scene.root_node.child_nodes:
if node.entity is not None:
mesh = node.entity
print(f"{node.name}: {len(mesh.control_points)} vertices, {mesh.polygon_count} polygons")
STL
STL stores triangle meshes as an unindexed list of facets. Both binary and ASCII variants are readable; StlSaveOptions.binary_mode controls which variant is written (it defaults to ASCII output).
from aspose.threed import Scene
from aspose.threed.formats import StlSaveOptions
scene = Scene.from_file("model.stl")
options = StlSaveOptions()
options.binary_mode = True
scene.save("output.stl", options)
glTF and GLB
glTF 2.0 preserves the full scene graph, node hierarchy, and materials, and is the most complete format the library supports for interchange with engines and web viewers. GltfSaveOptions.binary_mode switches output between the JSON (.gltf) and self-contained binary (.glb) containers.
from aspose.threed import Scene
from aspose.threed.formats.gltf import GltfSaveOptions
scene = Scene.from_file("model.obj")
options = GltfSaveOptions()
options.binary_mode = False
scene.save("model.gltf", options)
options.binary_mode = True
scene.save("model.glb", options)
COLLADA
COLLADA (.dae) is an XML-based format that carries scene hierarchy and material definitions. ColladaSaveOptions.flip_coordinate_system, ColladaSaveOptions.enable_materials, and ColladaSaveOptions.indented control the written output.
from aspose.threed import Scene
from aspose.threed.formats import ColladaSaveOptions
scene = Scene.from_file("model.dae")
options = ColladaSaveOptions()
options.flip_coordinate_system = True
options.indented = False
scene.save("output.dae", options)
3MF
3MF is a ZIP-based format aimed at additive manufacturing (3D printing) workflows. ThreeMfSaveOptions is the option class passed to scene.save() when writing this format.
from aspose.threed import Scene
from aspose.threed.formats import ThreeMfSaveOptions
scene = Scene.from_file("part.stl")
options = ThreeMfSaveOptions()
scene.save("part.3mf", options)
FBX (experimental)
FBX support is at the tokenizer level in this release: FbxTokenizer can parse the low-level token structure of an ASCII FBX file, but the full parser that builds nodes, meshes, and materials from those tokens has known gaps, so FBX read results should be verified before use. FBX write is not available — FbxExporter raises NotImplementedError for both save() and save_to_stream().
from aspose.threed.formats.fbx import FbxTokenizer
with open("model.fbx", "r", encoding="utf-8", errors="ignore") as f:
content = f.read()
tokenizer = FbxTokenizer(content)
tokens = tokenizer.tokenize()
print(f"Tokenized {len(tokens)} tokens")
If your source data is in FBX, convert it to glTF or OBJ with a 3D editor first, then load the converted file with Aspose.3D FOSS for Python.
Quick Start
pip install aspose-3d-fossLoad a 3D file, inspect its mesh data, and convert it to glTF — format detection in Scene.from_file() works from the file extension, so no format argument is required for the load step:
from aspose.threed import Scene
from aspose.threed.entities import Mesh
from aspose.threed.formats.gltf import GltfSaveOptions
scene = Scene.from_file("model.obj")
for node in scene.root_node.child_nodes:
entity = node.entity
if isinstance(entity, Mesh):
print(f"{node.name}: {len(entity.control_points)} vertices, "
f"{entity.polygon_count} polygons")
options = GltfSaveOptions()
options.binary_mode = True
scene.save("model.glb", options)
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| OBJ | .obj | ✓ | ✓ |
| STL | .stl | ✓ | ✓ |
| glTF / GLB | .gltf, .glb | ✓ | ✓ |
| COLLADA | .dae | ✓ | ✓ |
| 3MF | .3mf | ✓ | ✓ |
| FBX | .fbx | Partial (tokenizer-level, experimental) | — |
Open Source & Licensing
Aspose.3D FOSS for Python is MIT licensed, so it can be used, modified, and redistributed in commercial applications without restriction. The package is distributed on PyPI as aspose-3d-foss, with source available on GitHub under the Aspose organization.
Getting Started
- Getting Started
- Developer Guide
- Format Support Guide
- KB Articles
- How to Convert 3D Models in Python
- API Reference