FileFormat — Aspose.3D FOSS for Java
Methods
FileFormat एक फ़ॉर्मेट डिस्क्रिप्टर और सभी समर्थित 3D फ़ाइल फ़ॉर्मेट्स के रजिस्ट्री दोनों के रूप में कार्य करता है। प्रत्येक फ़ॉर्मेट को इस रूप में दर्शाया गया है। FileFormat इंस्टेंस को क्लास एट्रिब्यूट के रूप में या static factory methods के माध्यम से एक्सेस किया जा सकता है। आप पास FileFormat इंस्टेंस को Scene.save() एक विशिष्ट फ़ॉर्मेट को लागू करने के लिए, या उपयोग करें FileFormat.detect() एक अज्ञात फ़ाइल के फ़ॉर्मेट की पहचान करने के लिए।.
Methods: com.aspose.threed
import com.aspose.threed.FileFormat;समर्थित फ़ॉर्मेट स्थिरांक
फ़ॉर्मेट स्थिरांक जो FOSS रिलीज़ में सक्रिय रूप से समर्थित हैं (इम्पोर्टर्स और/या एक्सपोर्टर्स पंजीकृत), नीचे दिखाए गए हैं।.
सक्रिय रूप से समर्थित (FOSS रिलीज़)
| Methods | Methods | Methods |
|---|---|---|
FileFormat.WAVEFRONTOBJ | .obj | सार्वजनिक स्थिर अंतिम फ़ील्ड (ObjFormat इंस्टेंस) |
FileFormat.GLTF2 | .gltf / .glb | glTF 2.0 और GLB; सार्वजनिक स्थिर अंतिम फ़ील्ड (GltfFormat इंस्टेंस)। उपयोग करें GltfSaveOptions के साथ setContentType(FileContentType.BINARY) GLB आउटपुट के लिए।. |
FileFormat.FBX7400ASCII | .fbx | FBX 7.4 ASCII; केवल आयात (निर्यात नहीं) |
FileFormat.STL_BINARY | .stl | STL बाइनरी (क्लास लोड पर सेट किया गया) |
FileFormat.STLASCII | .stl | STL ASCII |
Methods
FBX versions 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.
स्थैतिक मेथड्स
| Methods | रिटर्न टाइप | Methods |
|---|---|---|
FileFormat.detect(InputStream stream, String fileName) | FileFormat | फ़ाइल स्ट्रीम से फ़ॉर्मेट का पता लगाता है; fileName संकेत के रूप में उपयोग किया जाता है |
FileFormat.getFormatByExtension(String ext) | FileFormat | एक एक्सटेंशन स्ट्रिंग जैसे … से मेल खाने वाला फ़ॉर्मेट लौटाता है ".obj", ".glb", ".fbx", ".stl" |
इंस्टेंस प्रॉपर्टीज़
| 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());
}
}