FileFormat

Methods

FileFormat ทำหน้าที่เป็นทั้งตัวบรรยายรูปแบบและทะเบียนของรูปแบบไฟล์ 3D ที่รองรับทั้งหมด แต่ละรูปแบบจะถูกแทนด้วย FileFormat อินสแตนซ์ที่เข้าถึงได้เป็นแอตทริบิวต์ของคลาสหรือผ่านเมธอดแฟกทอรีแบบสแตติก คุณส่ง FileFormat อินสแตนซ์ไปยัง Scene.save() เพื่อบังคับรูปแบบเฉพาะ หรือใช้ FileFormat.detect() เพื่อระบุรูปแบบของไฟล์ที่ไม่ทราบ.

Methods: com.aspose.threed

import com.aspose.threed.FileFormat;

ค่าคงที่รูปแบบที่รองรับ

ค่าคงที่รูปแบบที่ได้รับการสนับสนุนอย่างเต็มที่ (ผู้นำเข้าและ/หรือผู้ส่งออกที่ลงทะเบียน) ในรุ่น FOSS แสดงด้านล่าง.

สนับสนุนอย่างเต็มที่ (รุ่น FOSS)

NameTypeAccessDescription
formatsList<FileFormat>ReadGets the formats.
versionVersionReadGets the version.
canImportbooleanReadGets the can import.
canExportbooleanReadGets the can export.
extensionStringReadGets the extension.
extensionsString[]ReadGets the extensions.
contentTypeFileContentTypeReadGets the content type.
fileFormatTypeFileFormatTypeReadGets the file format type.
FBX6100ASCIIFileFormatReadGets the fbx6100 ascii.
FBX6100_BINARYFileFormatReadGets the fbx6100 binary.
FBX7200ASCIIFileFormatReadGets the fbx7200 ascii.
FBX7200_BINARYFileFormatReadGets the fbx7200 binary.
FBX7300ASCIIFileFormatReadGets the fbx7300 ascii.
FBX7300_BINARYFileFormatReadGets the fbx7300 binary.
FBX7400ASCIIFileFormatReadGets the fbx7400 ascii.
FBX7400_BINARYFileFormatReadGets the fbx7400 binary.
FBX7500ASCIIFileFormatReadGets the fbx7500 ascii.
FBX7500_BINARYFileFormatReadGets the fbx7500 binary.
FBX7600ASCIIFileFormatReadGets the fbx7600 ascii.
FBX7600_BINARYFileFormatReadGets the fbx7600 binary.
FBX7700ASCIIFileFormatReadGets the fbx7700 ascii.
FBX7700_BINARYFileFormatReadGets the fbx7700 binary.
MAYAASCIIFileFormatReadGets the mayaascii.
MAYA_BINARYFileFormatReadGets the maya binary.
STL_BINARYFileFormatReadGets the stl binary.
STLASCIIFileFormatReadGets the stlascii.
WAVEFRONTOBJFileFormatReadGets the wavefrontobj.
DISCREET3DSFileFormatReadGets the discreet3 ds.
COLLADAFileFormatReadGets the collada.
UNIVERSAL3DFileFormatReadGets the universal3 d.
GLTFFileFormatReadGets the gltf.
GLTF2FileFormatReadGets the gltf2.
GLTF_BINARYFileFormatReadGets the gltf binary.
GLTF2_BINARYFileFormatReadGets the gltf2 binary.
PDFPdfFormatReadGets the pdf.
BLENDERFileFormatReadGets the blender.
DXFFileFormatReadGets the dxf.
PLYPlyFormatReadGets the ply.
X_BINARYFileFormatReadGets the x binary.
X_TEXTFileFormatReadGets the x text.
DRACODracoFormatReadGets the draco.
MICROSOFT3MFMicrosoft3MFFormatReadGets the microsoft3 mf.
RVM_TEXTRvmFormatReadGets the rvm text.
RVM_BINARYRvmFormatReadGets the rvm binary.
ASEFileFormatReadGets the ase.
IFCFileFormatReadGets the ifc.
SIEMENSJT8FileFormatReadGets the siemensjt8.
SIEMENSJT9FileFormatReadGets the siemensjt9.
AMFFileFormatReadGets the amf.
VRMLFileFormatReadGets the vrml.
ASPOSE3D_WEBFileFormatReadGets the aspose3d web.
HTML5FileFormatReadGets the html5.
ZIPFileFormatReadGets the zip.
USDFileFormatReadGets the usd.
USDAFileFormatReadGets the usda.
USDZFileFormatReadGets the usdz.
XYZFileFormatReadGets the xyz.
PCDFileFormatReadGets the pcd.
PCD_BINARYFileFormatReadGets the pcd binary.

Methods

FBX เวอร์ชัน 6100-7700 (binary), Maya ASCII/Binary, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binary, PDF, Blender, DXF, PLY, X (binary/text), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binary.

เมธอดสแตติก

SignatureDescription
FileFormat(type: FileFormatType, version: Version, contentType: FileContentType, extension: String, extensions: String[], canImport: boolean, canExport: boolean)Calls FileFormat(type, version, contentType, extension, extensions, canImport, canExport) on this FileFormat instance.
getFormats()List<FileFormat>Returns the formats.
getVersion()VersionReturns the version.
getFormatByExtension(filePath: String)FileFormatCalls getFormatByExtension(filePath) on this FileFormat instance.
getCanImport()booleanReturns the can import.
getCanExport()booleanReturns the can export.
getExtension()StringReturns the extension.
getExtensions()String[]Returns the extensions.
getContentType()FileContentTypeReturns the content type.
getFileFormatType()FileFormatTypeReturns the file format type.
createLoadOptions()LoadOptionsCalls createLoadOptions on this FileFormat instance.
createSaveOptions()SaveOptionsCalls createSaveOptions on this FileFormat instance.
canDetect(stream: Stream, fileName: String)booleanCalls canDetect(stream, fileName) on this FileFormat instance.
detect(stream: Stream, fileName: String)FileFormatCalls detect(stream, fileName) on this FileFormat instance.
detect(fileName: String)FileFormatCalls detect(fileName) on this FileFormat instance.
registerFormat(format: FileFormat)Calls registerFormat(format) on this FileFormat instance.
toString()StringCalls toString on this FileFormat instance.

คุณสมบัติของอินสแตนซ์

MethodsMethodsMethodsMethods
extensionStringgetExtension()ส่วนขยายไฟล์หลัก (ไม่มีจุดนำหน้า)
extensionsList<String>getExtensions()ส่วนขยายทั้งหมดที่รองรับโดยรูปแบบนี้
contentTypeStringgetContentType()สตริงประเภท MIME
canExportbooleangetCanExport()ว่าการส่งออกเป็นรูปแบบนี้ได้รับการสนับสนุนหรือไม่
canImportbooleangetCanImport()ว่าการนำเข้าจากรูปแบบนี้ได้รับการสนับสนุนหรือไม่
versionStringgetVersion()สตริงเวอร์ชันของรูปแบบ

เมธอดของอินสแตนซ์

Methodsประเภทการคืนค่าMethods
createLoadOptions()LoadOptionsสร้างที่เหมาะสมตามฟอร์แมต LoadOptions คลาสย่อย
createSaveOptions()SaveOptionsสร้างที่เหมาะสมตามฟอร์แมต SaveOptions คลาสย่อย

Methods

import com.aspose.threed.Scene;
import com.aspose.threed.FileFormat;
import com.aspose.threed.*;

// Auto-detect and load
Scene scene = Scene.fromFile("model.obj");

// Save with explicit format (force GLB binary)
GltfSaveOptions opts = new GltfSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.glb", opts);

// Get format by extension
FileFormat fmt = FileFormat.getFormatByExtension(".fbx");
if (fmt != null) {
    System.out.println(fmt.getCanImport());   // true
    System.out.println(fmt.getCanExport());   // false (FBX export not available)
}

// Create options from a format instance
FileFormat fmtObj = FileFormat.getFormatByExtension(".obj");
LoadOptions loadOpts = fmtObj.createLoadOptions();   // ObjLoadOptions
SaveOptions saveOpts = fmtObj.createSaveOptions();   // ObjSaveOptions

// Detect format from file stream
try (FileInputStream fis = new FileInputStream("unknown_file.bin")) {
    FileFormat detected = FileFormat.detect(fis, "unknown_file.bin");
    if (detected != null) {
        System.out.println(detected.getClass().getSimpleName());
    }
}

ดูเพิ่มเติม

 ภาษาไทย