Scene, Node, Mesh, and Material, the core objects every 3D developer needs. Build a scene graph by creating Node objects and attaching mesh entities and materials with create_child_node(), construct mesh geometry directly with Mesh.create_polygon(), and assign surface properties using PbrMaterial, LambertMaterial, or PhongMaterial. Import and export OBJ, STL, glTF/GLB, COLLADA, and 3MF scenes through a unified Scene.open() / Scene.save() API, or call format-specific exporter and importer classes directly for finer control. Aspose.3D FOSS for Python is MIT-licensed and installs with a single pip command, with no native extensions to compile and no dependency on any commercial CAD application. This FOSS edition focuses on scene construction, mesh geometry, and format conversion — interactive rendering and GPU shader pipelines are not implemented in this open-source edition. Developers requiring enterprise features and production support can use Aspose.3D for Python — Enterprise Product alongside these open-source libraries.Scene is the entry point — Scene.open() loads a file, Scene.save() writes one, and Scene.from_file() offers a shortcut for quick loads.Node.add_child_node() and Node.create_child_node(); traverse with the child_nodes and parent_node properties.Node.add_entity() and the entity / material properties combine mesh, camera, and light entities with scene nodes directly.find_property(), get_property(), set_property(), and remove_property() attach arbitrary metadata to nodes and most scene objects.Mesh.create_polygon() and the control_points list define vertex data and faces entirely in code.Box, Sphere, Cylinder, Pyramid, Dish, and Torus each expose to_mesh() to produce editable Mesh geometry.PolygonModifier.triangulate() converts arbitrary polygons into triangle meshes for engines that require triangulated input.polygon_count, polygons, and control_points properties expose vertex and face data for analysis or custom processing.Scene.open() / Scene.save() support OBJ, STL, glTF/GLB, COLLADA, and 3MF for import and export.ObjExporter, StlExporter, GltfExporter, ColladaExporter, and ThreeMfExporter — plus their matching importers — expose export() / import_scene() directly for finer control than Scene.save() / Scene.open().FileFormat.get_format_by_extension() resolves a FileFormat from a file extension so your code doesn’t have to hardcode format logic.IOService.get_plugin_for_extension() and get_plugin_for_format() look up the registered importer, exporter, and detector for any supported format at runtime.PbrMaterial exposes albedo, metallic_factor, and roughness_factor for realistic surface definitions.LambertMaterial provides diffuse_color, ambient_color, emissive_color, and transparent_color; PhongMaterial adds specular_color, shininess, and reflection_color on top.Node.create_child_node() alongside the mesh entity, or set the material property afterward.pbrMetallicRoughness), COLLADA, and 3MF exports.Install with pip, then open an OBJ file into a Scene and walk the node hierarchy to inspect the mesh data attached to each node.
pip install aspose-3d-fossfrom 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")
Create a Box primitive, convert it to a Mesh with to_mesh(), assign a LambertMaterial, attach it to the scene’s root node, and save directly to glTF.
from aspose.threed import Scene
from aspose.threed.entities import Box
from aspose.threed.shading import LambertMaterial
from aspose.threed.utilities import Vector3
scene = Scene()
box = Box(length=2.0, width=1.0, height=1.0)
material = LambertMaterial()
material.diffuse_color = Vector3(0.2, 0.6, 0.9)
scene.root_node.create_child_node("Crate", entity=box.to_mesh(), material=material)
scene.save("crate.gltf")
Open an OBJ scene and run every node’s mesh entity through PolygonModifier.triangulate(), replacing the entity with its triangulated version when conversion succeeds.
from aspose.threed import Scene
from aspose.threed.entities import PolygonModifier
scene = Scene()
scene.open("model.obj")
for node in scene.root_node.child_nodes:
if node.entity is not None:
triangulated = PolygonModifier.triangulate(node.entity)
if triangulated is not None:
node.entity = triangulated
Create a Sphere primitive, assign a PbrMaterial with albedo, metallic, and roughness values, attach it to the scene, and export to STL.
from aspose.threed import Scene
from aspose.threed.entities import Sphere
from aspose.threed.shading import PbrMaterial
from aspose.threed.utilities import Vector3
scene = Scene()
sphere = Sphere()
material = PbrMaterial(albedo=Vector3(0.8, 0.1, 0.1))
material.metallic_factor = 0.9
material.roughness_factor = 0.2
scene.root_node.create_child_node("Ball", entity=sphere.to_mesh(), material=material)
scene.save("ball.stl")
Aspose.3D FOSS for Python is distributed under the MIT License, a permissive open-source license that allows free use, modification, and redistribution, provided the original copyright notice and license text are preserved.
Yes. The MIT License explicitly permits use in commercial, closed-source products without royalty obligations, as long as the license text is included with any distributed copies of the source.
Install with pip install aspose-3d-foss. The project declares python_requires=">=3.7", so Python 3.7 and later are supported.
No. The package is pure Python with no runtime dependency entries declared in its packaging metadata — there is no native extension module or external binary dependency to install separately.
OBJ, STL (binary and ASCII), glTF/GLB, COLLADA (.dae), and 3MF all support a reliable round trip through Scene.open() / Scene.save(). FBX loading is supported through the FBX importer, but FBX saving is not implemented — FbxExporter.save() and FbxExporter.save_to_stream() both raise a not-implemented error at call time.
FBX import is experimental — the parser has known structural issues with deeply nested or unusual FBX scope structures and can hit Python’s recursion limit on complex files. FBX export is not available at all in this release. For production workflows, prefer OBJ, glTF/GLB, COLLADA, or 3MF, and reserve FBX for simple, flat-geometry import only.