FileFormat

Metode

Methods FileFormat kelas adalah registri semua format file 3D yang didukung. Tidak ada konstanta bernama publik untuk format individual — instance format diperoleh pada waktu runtime melalui metode penemuan statis atau Formats koleksi.

Registri Format

Format yang didukung didaftarkan secara internal. Gunakan API berikut untuk mengaksesnya:

NameTypeAccessDescription
FormatsIList<FileFormat>ReadGets the formats.
VersionVersionReadGets the version.
CanExportboolReadGets the can export.
CanImportboolReadGets the can import.
ExtensionstringReadGets the extension.
Extensionsstring[]ReadGets the extensions.
ContentTypeFileContentTypeReadGets the content type.
FileFormatTypeFileFormatTypeReadGets the file format type.
FBXFileFormatReadGets the fbx.
OBJFileFormatReadGets the obj.
STLFileFormatReadGets the stl.
GLTFFileFormatReadGets the gltf.
GLTF_BinaryFileFormatReadGets the gltf binary.
PDFFormats.PdfFormatReadGets the pdf.
PLYFormats.PlyFormatReadGets the ply.
Microsoft3MFFormats.Microsoft3MFFormatReadGets the microsoft3 mf.
DracoFormats.DracoFormatReadGets the draco.
RvmTextFormats.RvmFormatReadGets the rvm text.
RvmBinaryFormats.RvmFormatReadGets the rvm binary.
BlenderFileFormatReadGets the blender.
DXFFileFormatReadGets the dxf.
XBinaryFileFormatReadGets the x binary.
XTextFileFormatReadGets the x text.
ASEFileFormatReadGets the ase.
IFCFileFormatReadGets the ifc.
SiemensJT8FileFormatReadGets the siemens jt8.
SiemensJT9FileFormatReadGets the siemens jt9.
AMFFileFormatReadGets the amf.
VRMLFileFormatReadGets the vrml.
Aspose3DWebFileFormatReadGets the aspose3 d web.
HTML5FileFormatReadGets the html5.
ZipFileFormatReadGets the zip.
USDFileFormatReadGets the usd.
USDAFileFormatReadGets the usda.
USDZFileFormatReadGets the usdz.
XyzFileFormatReadGets the xyz.
PcdFileFormatReadGets the pcd.
PcdBinaryFileFormatReadGets the pcd binary.

Format yang terdaftar meliputi: OBJ, STL, glTF/GLB, FBX, COLLADA, PLY, dan 3MF.

Metode

SignatureDescription
CanDetect(stream: Stream, fileName: string?)True if this format can handle the file
GetFormatByExtension(extensionName: string)Gets the preferred file format from the file extension name The extension name should starts with a dot(’.’).
Detect(fileName: string)Detects file format from file name, file must be readable so Aspose.3D can detect file format through file header.
Detect(stream: Stream, fileName: string)Detects file format from file name, file must be readable so Aspose.3D can detect file format through file header.
CreateLoadOptions()Not implemented in the FOSS edition — throws at runtime. Creates a default load options object for this format
CreateSaveOptions()Not implemented in the FOSS edition — throws at runtime. Creates a default save options object for this format
ToString()Formats to string

Catatan tentang CreateLoadOptions() / CreateSaveOptions(): Metode-metode ini berfungsi dengan benar ketika dipanggil pada instance format yang dikembalikan oleh Detect() atau GetFormatByExtension() — setiap yang terdaftar format menggantikan metode ini dengan implementasinya sendiri. Memanggilnya pada kelas dasar mentah FileFormat instance (tidak diperoleh melalui registry) melempar NotImplementedException.

Metode

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}");

Lihat Juga

 Bahasa Indonesia