FileFormat — Aspose.3D FOSS for .NET

Methods

Methods FileFormat class is a registry of all supported 3D file formats. There are no public named constants for individual formats — format instances are obtained at runtime through the static discovery methods or the Formats collection.

Formatregister

Ondersteunde formaten worden intern geregistreerd. Gebruik de volgende API om ze te benaderen:

MethodsMethodsMethods
FileFormat.FormatsIList<FileFormat>All registered format instances
FileFormat.Detect(string filePath)FileFormatDetects format from a file path (by extension and content)
FileFormat.GetFormatByExtension(string ext)FileFormatReturns the format for a given file extension (e.g. ".obj")

Geregistreerde formaten omvatten: OBJ, STL, glTF/GLB, FBX, COLLADA, PLY en 3MF.

Methods

MethodsReturn TypeMethods
Detect(string filePath)FileFormatDetects the format from a file path
GetFormatByExtension(string ext)FileFormatReturns the format matching the extension
CreateLoadOptions()LoadOptionsReturns load options appropriate for this format instance
CreateSaveOptions()SaveOptionsReturns save options appropriate for this format instance

Note on CreateLoadOptions() / CreateSaveOptions(): These methods work correctly when called on format instances returned by Detect() or GetFormatByExtension() — each registered format overrides these methods with its own implementation. Calling them on a raw base-class FileFormat instance (niet verkregen via het register) gooit NotImplementedException.

Methods

using Aspose.ThreeD;
using Aspose.ThreeD.Formats;

// Detect format from a file path
var format = FileFormat.Detect("model.obj");
Console.WriteLine(format.Extension); // ".obj"

// Get load options from the detected format instance
var loadOpts = format.CreateLoadOptions(); // returns ObjLoadOptions via polymorphism

// Load and save — format inferred from extension
var scene = new Scene();
scene.Open("model.obj");
scene.Save("output.glb");  // binary GLB inferred from .glb extension

// Enumerate all registered formats
foreach (var fmt in FileFormat.Formats)
    Console.WriteLine($"{fmt.Extension}: import={fmt.CanImport}, export={fmt.CanExport}");

Zie ook

 Nederlands