FileFormat

Methods

FileFormat dient zowel als een formatdescriptor als een register van alle ondersteunde 3D‑bestandsformaten. Elk format wordt weergegeven als een FileFormat instance die toegankelijk is als een klasse‑attribuut of via statische fabrieksmethoden. Je geeft FileFormat instances aan Scene.save() om een specifiek format af te dwingen, of gebruik FileFormat.detect() om het format van een onbekend bestand te identificeren.

Methods: aspose.threed

from aspose.threed import FileFormat

Ondersteunde Formaatconstanten

Formaatconstanten die actief worden ondersteund (importeurs en/of exporteurs geregistreerd) in de FOSS‑release worden hieronder getoond. Constanten die vermeld staan als None in de bron zijn gereserveerde namen voor formaten die nog niet geïmplementeerd zijn.

Actief Ondersteund (FOSS‑release)

MethodsMethodsMethods
FileFormat.WAVEFRONT_OBJ().objStatische methode die een ObjFormat instance
FileFormat.GLTF2().gltf / .glbglTF 2.0; statische methode die een GltfFormat instance
FileFormat.FBX7400ASCII().fbxFBX 7.4 ASCII; statische methode
FileFormat.MICROSOFT_3MF.3mf3MF (set at module load)
FileFormat.COLLADA.daeMethods
FileFormat.STL_BINARY.stlSTL binair (ingesteld bij het laden van de module)
FileFormat.STLASCII.stlSTL ASCII

Methods

FBX‑versies 6100–7700 (binair), Maya ASCII/Binary, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binary, PDF, Blender, DXF, PLY, X (binair/tekst), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binary.

Statische Methoden

MethodsRetourtypeMethods
FileFormat.detect(stream, file_name)`FileFormatNone`
FileFormat.get_format_by_extension(ext)`FileFormatNone`

Instantie‑eigenschappen

MethodsMethodsMethods
extensionstrPrimaire bestandsextensie (zonder voorafgaande punt)
extensionslist[str]Alle extensies die door dit formaat worden ondersteund
content_typestrMIME-type string
can_exportboolOf exporteren naar dit formaat wordt ondersteund
can_importboolOf importeren vanuit dit formaat wordt ondersteund
versionstrFormaatversiestring

Instantiemethoden

MethodsRetourtypeMethods
create_load_options()LoadOptionsMaakt de juiste formaat-specifieke LoadOptions subclass
create_save_options()SaveOptionsMaakt de juiste formaat-specifieke SaveOptions subclass

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__)

Zie ook

 Nederlands