FileFormat — Aspose.3D FOSS for Java
Methods
FileFormat フォーマット記述子として、またサポートされているすべての3Dファイルフォーマットのレジストリとして機能します。各フォーマットは FileFormat インスタンスはクラス属性として、または静的ファクトリメソッドを通じてアクセス可能です。あなたは FileFormat インスタンスを Scene.save() に渡して特定のフォーマットを強制するか、または FileFormat.detect() を使用して不明なファイルのフォーマットを識別します。.
Methods: com.aspose.threed
import com.aspose.threed.FileFormat;サポートされているフォーマット定数
FOSS リリースでアクティブにサポートされている(インポーターおよび/またはエクスポーターが登録されている)フォーマット定数を以下に示します。.
アクティブにサポートされている(FOSS リリース)
| Methods | Methods | Methods |
|---|---|---|
FileFormat.WAVEFRONTOBJ | .obj | Public static final フィールド(ObjFormat インスタンス) |
FileFormat.GLTF2 | .gltf / .glb | glTF 2.0 と GLB;public static final フィールド(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());
}
}