FileFormat

Methods

FileFormat berfungsi sebagai deskripsi format sekaligus registri semua format file 3D yang didukung. Setiap format direpresentasikan sebagai FileFormat instance yang dapat diakses sebagai atribut kelas atau melalui metode pabrik statis. Anda mengirim FileFormat instance ke Scene.save() untuk memaksa format tertentu, atau gunakan FileFormat.detect() untuk mengidentifikasi format file yang tidak diketahui.

Methods: aspose.threed

from aspose.threed import FileFormat

Konstanta Format yang Didukung

Konstanta format yang secara aktif didukung (importir dan/atau pengekspor yang terdaftar) dalam rilis FOSS ditampilkan di bawah ini. Konstanta yang tercantum sebagai None di dalam sumber adalah nama yang dipesan untuk format yang belum diimplementasikan.

Didukung Secara Aktif (rilis FOSS)

MethodsMethodsMethods
FileFormat.WAVEFRONT_OBJ().objMetode statis yang mengembalikan sebuah ObjFormat instance
FileFormat.GLTF2().gltf / .glbglTF 2.0; metode statis yang mengembalikan sebuah GltfFormat instance
FileFormat.FBX7400ASCII().fbxFBX 7.4 ASCII; metode statis
FileFormat.MICROSOFT_3MF.3mf3MF (set at module load)
FileFormat.COLLADA.daeMethods
FileFormat.STL_BINARY.stlSTL biner (ditetapkan saat modul dimuat)
FileFormat.STLASCII.stlSTL ASCII

Methods

versi FBX 6100–7700 (biner), Maya ASCII/Biner, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF biner, PDF, Blender, DXF, PLY, X (biner/teks), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD biner.

Metode Statis

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

Properti Instance

MethodsMethodsMethods
extensionstrEkstensi file utama (tanpa titik di depan)
extensionslist[str]Semua ekstensi yang didukung oleh format ini
content_typestrString tipe MIME
can_exportboolApakah mengekspor ke format ini didukung
can_importboolApakah mengimpor dari format ini didukung
versionstrString versi format

Metode Instansi

MethodsTipe PengembalianMethods
create_load_options()LoadOptionsMembuat format-spesifik yang sesuai LoadOptions subkelas
create_save_options()SaveOptionsMembuat format-spesifik yang sesuai SaveOptions subkelas

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

Lihat Juga

 Bahasa Indonesia