Load and Save Options — Aspose.3D FOSS for Java
Overview
All import and export operations accept an optional options object derived from LoadOptions or SaveOptions. Pass the appropriate subclass to Scene.open() or Scene.save() to control format-specific behaviour.
Package: com.aspose.threed
import com.aspose.threed.*;LoadOptions
Base class for all load-option objects. Extends A3DObject.
| Name | Type | Getter | Description |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | The format this config is associated with (read-only) |
SaveOptions
Base class for all save-option objects. Extends A3DObject.
| Name | Type | Getter | Description |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | The format this config is associated with (read-only) |
ObjLoadOptions
Load options for Wavefront OBJ files (.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);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on import |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | Load the accompanying .mtl material file |
scale | double | getScale() | setScale(double) | 1.0 | Uniform scale applied to all imported geometry |
normalizeNormal | boolean | getNormalizeNormal() | setNormalizeNormal(boolean) | true | Normalise imported normal vectors to unit length |
ObjSaveOptions
Save options for Wavefront OBJ files.
import com.aspose.threed.*;
ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
applyUnitScale | boolean | getApplyUnitScale() | setApplyUnitScale(boolean) | false | Apply the scene’s unit scale factor to exported coordinates |
pointCloud | boolean | getPointCloud() | setPointCloud(boolean) | false | Export vertices only (no polygon faces) |
verbose | boolean | getVerbose() | setVerbose(boolean) | false | Include additional OBJ comments in the output |
serializeW | boolean | getSerializeW() | setSerializeW(boolean) | false | Write the W component of control points |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | Write a .mtl material file and reference it from the .obj |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on export |
GltfLoadOptions
Load options for glTF 2.0 and GLB files (.gltf, .glb).
import com.aspose.threed.*;
GltfLoadOptions opts = new GltfLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("model.gltf", opts);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on import |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | Format output JSON with indentation for readability |
GltfSaveOptions
Save options for glTF 2.0 and GLB output.
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);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.ASCII | Set to FileContentType.BINARY to produce a self-contained GLB file; set to FileContentType.ASCII for JSON .gltf with an external buffer |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on export |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | Format the output JSON with indentation for readability |
bufferFilePrefix | String | getBufferFilePrefix() | setBufferFilePrefix(String) | null | Prefix for external buffer file names |
saveExtras | String | getSaveExtras() | setSaveExtras(String) | null | Custom extras data to include in the glTF output |
StlLoadOptions
Load options for STL files (.stl).
import com.aspose.threed.*;
StlLoadOptions opts = new StlLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("part.stl", opts);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on import |
recalculateNormal | boolean | getRecalculateNormal() | setRecalculateNormal(boolean) | false | Recalculate normals from geometry on import |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | – | Hint for binary vs ASCII STL detection |
StlSaveOptions
Save options for STL output.
import com.aspose.threed.*;
StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on export |
axisSystem | AxisSystem | getAxisSystem() | setAxisSystem(AxisSystem) | – | Override the target axis system on export |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.BINARY | Set to BINARY or ASCII to control output format |
FbxLoadOptions
Load options for FBX files (.fbx).
import com.aspose.threed.*;
FbxLoadOptions opts = new FbxLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("animation.fbx", opts);| Property | Type | Getter | Setter | Default | Description |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Flip the coordinate system on import |
FbxSaveOptions
Note: FBX export is not available in the Java FOSS edition. FBX is supported for import only. The
FbxSaveOptionsclass exists in the API but will produce an error if used to save. Use OBJ, STL, glTF, or GLB for export instead.