Quick Start
Quick Start
This guide shows the fastest path from installation to loading and saving a 3D file using Aspose.3D FOSS for .NET. The library is MIT-licensed, pure C#, and requires no native binaries or external dependencies beyond the NuGet package.
Prerequisites
| Requirement | Detail |
|---|---|
| .NET | 10.0 or later |
| OS | Windows, macOS, Linux, Docker |
| Package | Aspose.3D from NuGet |
Install
Install from NuGet. The library detects 3D file formats automatically from file extensions, so no explicit format constants are needed for basic use:
dotnet add package Aspose.3D --version 26.1.0Load a 3D File
Call Scene.FromFile() with a path to load any supported format. The library detects the
format from the file extension. Access the scene hierarchy through scene.RootNode:
using Aspose.ThreeD;
var scene = Scene.FromFile("model.obj");
Console.WriteLine($"Root node: {scene.RootNode.Name}");Traverse the Scene Graph
A loaded scene is a tree of Node objects rooted at scene.RootNode. Use
a recursive walk to print or process each node and its children:
using Aspose.ThreeD;
void Walk(Node node, int depth = 0)
{
var indent = new string(' ', depth * 2);
Console.WriteLine($"{indent}Node: {node.Name}");
foreach (var child in node.ChildNodes)
Walk(child, depth + 1);
}
var scene = Scene.FromFile("model.glb");
Walk(scene.RootNode);Save to a Different Format
The library detects the output format from the file extension:
using Aspose.ThreeD;
var scene = Scene.FromFile("model.obj");
scene.Save("output.glb");
Console.WriteLine("Converted to GLB.");Create a New Scene and Save
Construct a Scene with no arguments to start empty, add child nodes to scene.RootNode,
then call scene.Save() to write it to disk in the desired format:
using Aspose.ThreeD;
var scene = new Scene();
var node = scene.RootNode.CreateChildNode("box");
scene.Save("new_scene.obj");