FileFormat
Methods
FileFormat ทำหน้าที่เป็นทั้งตัวบรรยายรูปแบบและทะเบียนของรูปแบบไฟล์ 3D ที่รองรับทั้งหมด แต่ละรูปแบบจะถูกแทนด้วย FileFormat อินสแตนซ์ที่เข้าถึงได้เป็นแอตทริบิวต์ของคลาสหรือผ่านเมธอดแฟกทอรีแบบสแตติก คุณส่ง FileFormat อินสแตนซ์ไปยัง Scene.save() เพื่อบังคับรูปแบบเฉพาะ หรือใช้ FileFormat.detect() เพื่อระบุรูปแบบของไฟล์ที่ไม่ทราบ.
Methods: com.aspose.threed
import com.aspose.threed.FileFormat;ค่าคงที่รูปแบบที่รองรับ
ค่าคงที่รูปแบบที่ได้รับการสนับสนุนอย่างเต็มที่ (ผู้นำเข้าและ/หรือผู้ส่งออกที่ลงทะเบียน) ในรุ่น FOSS แสดงด้านล่าง.
สนับสนุนอย่างเต็มที่ (รุ่น FOSS)
| Name | Type | Access | Description |
|---|---|---|---|
formats | List<FileFormat> | Read | Gets the formats. |
version | Version | Read | Gets the version. |
canImport | boolean | Read | Gets the can import. |
canExport | boolean | Read | Gets the can export. |
extension | String | Read | Gets the extension. |
extensions | String[] | Read | Gets the extensions. |
contentType | FileContentType | Read | Gets the content type. |
fileFormatType | FileFormatType | Read | Gets the file format type. |
FBX6100ASCII | FileFormat | Read | Gets the fbx6100 ascii. |
FBX6100_BINARY | FileFormat | Read | Gets the fbx6100 binary. |
FBX7200ASCII | FileFormat | Read | Gets the fbx7200 ascii. |
FBX7200_BINARY | FileFormat | Read | Gets the fbx7200 binary. |
FBX7300ASCII | FileFormat | Read | Gets the fbx7300 ascii. |
FBX7300_BINARY | FileFormat | Read | Gets the fbx7300 binary. |
FBX7400ASCII | FileFormat | Read | Gets the fbx7400 ascii. |
FBX7400_BINARY | FileFormat | Read | Gets the fbx7400 binary. |
FBX7500ASCII | FileFormat | Read | Gets the fbx7500 ascii. |
FBX7500_BINARY | FileFormat | Read | Gets the fbx7500 binary. |
FBX7600ASCII | FileFormat | Read | Gets the fbx7600 ascii. |
FBX7600_BINARY | FileFormat | Read | Gets the fbx7600 binary. |
FBX7700ASCII | FileFormat | Read | Gets the fbx7700 ascii. |
FBX7700_BINARY | FileFormat | Read | Gets the fbx7700 binary. |
MAYAASCII | FileFormat | Read | Gets the mayaascii. |
MAYA_BINARY | FileFormat | Read | Gets the maya binary. |
STL_BINARY | FileFormat | Read | Gets the stl binary. |
STLASCII | FileFormat | Read | Gets the stlascii. |
WAVEFRONTOBJ | FileFormat | Read | Gets the wavefrontobj. |
DISCREET3DS | FileFormat | Read | Gets the discreet3 ds. |
COLLADA | FileFormat | Read | Gets the collada. |
UNIVERSAL3D | FileFormat | Read | Gets the universal3 d. |
GLTF | FileFormat | Read | Gets the gltf. |
GLTF2 | FileFormat | Read | Gets the gltf2. |
GLTF_BINARY | FileFormat | Read | Gets the gltf binary. |
GLTF2_BINARY | FileFormat | Read | Gets the gltf2 binary. |
PDF | PdfFormat | Read | Gets the pdf. |
BLENDER | FileFormat | Read | Gets the blender. |
DXF | FileFormat | Read | Gets the dxf. |
PLY | PlyFormat | Read | Gets the ply. |
X_BINARY | FileFormat | Read | Gets the x binary. |
X_TEXT | FileFormat | Read | Gets the x text. |
DRACO | DracoFormat | Read | Gets the draco. |
MICROSOFT3MF | Microsoft3MFFormat | Read | Gets the microsoft3 mf. |
RVM_TEXT | RvmFormat | Read | Gets the rvm text. |
RVM_BINARY | RvmFormat | Read | Gets the rvm binary. |
ASE | FileFormat | Read | Gets the ase. |
IFC | FileFormat | Read | Gets the ifc. |
SIEMENSJT8 | FileFormat | Read | Gets the siemensjt8. |
SIEMENSJT9 | FileFormat | Read | Gets the siemensjt9. |
AMF | FileFormat | Read | Gets the amf. |
VRML | FileFormat | Read | Gets the vrml. |
ASPOSE3D_WEB | FileFormat | Read | Gets the aspose3d web. |
HTML5 | FileFormat | Read | Gets the html5. |
ZIP | FileFormat | Read | Gets the zip. |
USD | FileFormat | Read | Gets the usd. |
USDA | FileFormat | Read | Gets the usda. |
USDZ | FileFormat | Read | Gets the usdz. |
XYZ | FileFormat | Read | Gets the xyz. |
PCD | FileFormat | Read | Gets the pcd. |
PCD_BINARY | FileFormat | Read | Gets 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.
เมธอดสแตติก
| Signature | Description |
|---|---|
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() → Version | Returns the version. |
getFormatByExtension(filePath: String) → FileFormat | Calls getFormatByExtension(filePath) on this FileFormat instance. |
getCanImport() → boolean | Returns the can import. |
getCanExport() → boolean | Returns the can export. |
getExtension() → String | Returns the extension. |
getExtensions() → String[] | Returns the extensions. |
getContentType() → FileContentType | Returns the content type. |
getFileFormatType() → FileFormatType | Returns the file format type. |
createLoadOptions() → LoadOptions | Calls createLoadOptions on this FileFormat instance. |
createSaveOptions() → SaveOptions | Calls createSaveOptions on this FileFormat instance. |
canDetect(stream: Stream, fileName: String) → boolean | Calls canDetect(stream, fileName) on this FileFormat instance. |
detect(stream: Stream, fileName: String) → FileFormat | Calls detect(stream, fileName) on this FileFormat instance. |
detect(fileName: String) → FileFormat | Calls detect(fileName) on this FileFormat instance. |
registerFormat(format: FileFormat) | Calls registerFormat(format) on this FileFormat instance. |
toString() → String | Calls toString on this FileFormat instance. |
คุณสมบัติของอินสแตนซ์
| Methods | Methods | Methods | Methods |
|---|---|---|---|
extension | String | getExtension() | ส่วนขยายไฟล์หลัก (ไม่มีจุดนำหน้า) |
extensions | List<String> | getExtensions() | ส่วนขยายทั้งหมดที่รองรับโดยรูปแบบนี้ |
contentType | String | getContentType() | สตริงประเภท MIME |
canExport | boolean | getCanExport() | ว่าการส่งออกเป็นรูปแบบนี้ได้รับการสนับสนุนหรือไม่ |
canImport | boolean | getCanImport() | ว่าการนำเข้าจากรูปแบบนี้ได้รับการสนับสนุนหรือไม่ |
version | String | getVersion() | สตริงเวอร์ชันของรูปแบบ |
เมธอดของอินสแตนซ์
| 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());
}
}