FileFormat — Aspose.3D FOSS for Python API Reference
Methods
FileFormat dient sowohl als Formatbeschreiber als auch als Register aller unterstützten 3D-Dateiformate. Jedes Format wird als ein FileFormat Instanz, die als Klassenattribut oder über statische Fabrikmethoden zugänglich ist. Sie übergeben FileFormat Instanzen an Scene.save() um ein bestimmtes Format zu erzwingen, oder verwenden Sie FileFormat.detect() um das Format einer unbekannten Datei zu ermitteln.
Methods: aspose.threed
from aspose.threed import FileFormatUnterstützte Formatkonstanten
Formatkonstanten, die im FOSS-Release aktiv unterstützt werden (Importeure und/oder Exporteure registriert), sind unten aufgeführt. Als None im Quellcode sind reservierte Namen für noch nicht implementierte Formate.
Aktiv unterstützt (FOSS‑Release)
| Methods | Methods | Methods |
|---|---|---|
FileFormat.WAVEFRONT_OBJ() | .obj | Statische Methode, die ein ObjFormat Instanz |
FileFormat.GLTF2() | .gltf / .glb | glTF 2.0 zurückgibt; statische Methode, die ein GltfFormat Instanz |
FileFormat.FBX7400ASCII() | .fbx | FBX 7.4 ASCII; statische Methode |
FileFormat.MICROSOFT_3MF | .3mf | 3MF (set at module load) |
FileFormat.COLLADA | .dae | Methods |
FileFormat.STL_BINARY | .stl | STL binary (bei Modul‑Ladung gesetzt) |
FileFormat.STLASCII | .stl | STL ASCII |
Methods
FBX-Versionen 6100–7700 (binär), Maya ASCII/Binär, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binär, PDF, Blender, DXF, PLY, X (binär/Text), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binär.
Statische Methoden
| Methods | Rückgabetyp | Methods |
|---|---|---|
FileFormat.detect(stream, file_name) | `FileFormat | None` |
FileFormat.get_format_by_extension(ext) | `FileFormat | None` |
Instanz‑Eigenschaften
| Methods | Methods | Methods |
|---|---|---|
extension | str | Primäre Dateierweiterung (ohne führenden Punkt) |
extensions | list[str] | Alle von diesem Format unterstützten Erweiterungen |
content_type | str | MIME‑Typ‑Zeichenkette |
can_export | bool | Ob das Exportieren in dieses Format unterstützt wird |
can_import | bool | Ob das Importieren aus diesem Format unterstützt wird |
version | str | Formatversionszeichenkette |
Instanzmethoden
| Methods | Rückgabetyp | Methods |
|---|---|---|
create_load_options() | LoadOptions | Erstellt das passende formatabhängige LoadOptions Unterklasse |
create_save_options() | SaveOptions | Erstellt das passende formatabhängige SaveOptions Unterklasse |
Methods
from aspose.threed import Scene, FileFormat
# Auto-detect and load
scene = Scene.from_file("model.obj")
# Save with explicit format (force GLB binary)
from aspose.threed.formats import GltfSaveOptions
opts = GltfSaveOptions()
opts.binary_mode = True
scene.save("output.glb", opts)
# Get format by extension
fmt = FileFormat.get_format_by_extension(".fbx")
if fmt:
print(fmt.can_import) # True
print(fmt.can_export) # True
# Create options from a format instance
fmt_obj = FileFormat.get_format_by_extension(".obj")
load_opts = fmt_obj.create_load_options() # ObjLoadOptions
save_opts = fmt_obj.create_save_options() # ObjSaveOptions
# Detect format from file stream
with open("unknown_file.bin", "rb") as f:
detected = FileFormat.detect(f, "unknown_file.bin")
if detected:
print(type(detected).__name__)