Load and Save Options — Aspose.3D FOSS for Java
Properties
Tất cả các thao tác nhập và xuất chấp nhận một đối tượng options object tùy chọn được suy ra từ LoadOptions hoặc SaveOptions. Gửi subclass thích hợp tới Scene.open() hoặc Scene.save() để kiểm soát hành vi đặc thù của định dạng.
Properties: com.aspose.threed
import com.aspose.threed.*;LoadOptions
Lớp cơ sở cho tất cả các đối tượng load-option. Extends A3DObject.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | Định dạng mà cấu hình này liên kết (read-only) |
SaveOptions
Lớp cơ sở cho tất cả các đối tượng save-option. Extends A3DObject.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | Định dạng mà cấu hình này liên kết tới (chỉ đọc) |
ObjLoadOptions
Tùy chọn tải cho các tệp Wavefront OBJ (.obj).
import com.aspose.threed.*;
ObjLoadOptions opts = new ObjLoadOptions();
opts.setFlipCoordinateSystem(true);
opts.setScale(0.01);
Scene scene = new Scene();
scene.open("model.obj", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo ngược hệ tọa độ khi nhập |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | Tải tệp đi kèm .mtl tệp vật liệu |
scale | double | getScale() | setScale(double) | 1.0 | Tỷ lệ đồng nhất được áp dụng cho tất cả hình học đã nhập |
normalizeNormal | boolean | getNormalizeNormal() | setNormalizeNormal(boolean) | true | Chuẩn hoá các vectơ pháp tuyến đã nhập về độ dài đơn vị |
ObjSaveOptions
Tùy chọn lưu cho các tệp Wavefront OBJ.
import com.aspose.threed.*;
ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
applyUnitScale | boolean | getApplyUnitScale() | setApplyUnitScale(boolean) | false | Áp dụng hệ số tỷ lệ đơn vị của cảnh cho các tọa độ đã xuất |
pointCloud | boolean | getPointCloud() | setPointCloud(boolean) | false | Xuất chỉ các đỉnh (không có mặt đa giác) |
verbose | boolean | getVerbose() | setVerbose(boolean) | false | Bao gồm các chú thích OBJ bổ sung trong đầu ra |
serializeW | boolean | getSerializeW() | setSerializeW(boolean) | false | Ghi thành phần W của các điểm điều khiển |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | Ghi một .mtl tệp vật liệu và tham chiếu nó từ .obj |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi xuất |
GltfLoadOptions
Tùy chọn tải cho các tệp glTF 2.0 và GLB (.gltf, .glb).
import com.aspose.threed.*;
GltfLoadOptions opts = new GltfLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("model.gltf", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi nhập |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | Định dạng JSON đầu ra với thụt lề để dễ đọc |
GltfSaveOptions
Tùy chọn lưu cho đầu ra glTF 2.0 và GLB.
import com.aspose.threed.*;
import com.aspose.threed.FileContentType;
// Save as glTF JSON
GltfSaveOptions opts = new GltfSaveOptions();
scene.save("output.gltf", opts);
// Save as GLB (binary glTF)
GltfSaveOptions glbOpts = new GltfSaveOptions();
glbOpts.setContentType(FileContentType.BINARY);
scene.save("output.glb", glbOpts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.ASCII | Đặt thành FileContentType.BINARY để tạo tệp GLB tự chứa; đặt thành FileContentType.ASCII cho JSON .gltf với bộ đệm bên ngoài |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi xuất |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | Định dạng JSON đầu ra với thụt lề để dễ đọc |
bufferFilePrefix | String | getBufferFilePrefix() | setBufferFilePrefix(String) | null | Tiền tố cho tên tệp bộ đệm bên ngoài |
saveExtras | String | getSaveExtras() | setSaveExtras(String) | null | Dữ liệu extras tùy chỉnh để bao gồm trong đầu ra glTF |
StlLoadOptions
Tùy chọn tải cho các tệp STL (.stl).
import com.aspose.threed.*;
StlLoadOptions opts = new StlLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("part.stl", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi nhập |
recalculateNormal | boolean | getRecalculateNormal() | setRecalculateNormal(boolean) | false | Tính lại các vector pháp tuyến từ hình học khi nhập |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | – | Gợi ý để phát hiện STL nhị phân so với ASCII |
StlSaveOptions
Tùy chọn lưu cho đầu ra STL.
import com.aspose.threed.*;
StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi xuất |
axisSystem | AxisSystem | getAxisSystem() | setAxisSystem(AxisSystem) | – | Ghi đè hệ thống trục mục tiêu khi xuất |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.BINARY | Đặt thành BINARY hoặc ASCII để kiểm soát định dạng đầu ra |
FbxLoadOptions
Tải các tùy chọn cho tệp FBX (.fbx).
import com.aspose.threed.*;
FbxLoadOptions opts = new FbxLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("animation.fbx", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Đảo hệ tọa độ khi nhập |
FbxSaveOptions
Lưu ý: Xuất FBX là không khả dụng trong phiên bản FOSS Java. FBX chỉ được hỗ trợ để nhập. The FbxSaveOptions Lớp tồn tại trong API nhưng sẽ gây ra lỗi nếu dùng để lưu. Thay vào đó, hãy sử dụng OBJ, STL, glTF hoặc GLB để xuất.