Load and Save Options

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.

NameTypeGetterDescription
fileFormatFileFormatgetFileFormat()The format this config is associated with (read-only)

SaveOptions

Base class for all save-option objects. Extends A3DObject.

NameTypeGetterDescription
fileFormatFileFormatgetFileFormat()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);
PropertyTypeGetterSetterDefaultDescription
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on import
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueLoad the accompanying .mtl material file
scaledoublegetScale()setScale(double)1.0Uniform scale applied to all imported geometry
normalizeNormalbooleangetNormalizeNormal()setNormalizeNormal(boolean)trueNormalise 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);
PropertyTypeGetterSetterDefaultDescription
applyUnitScalebooleangetApplyUnitScale()setApplyUnitScale(boolean)falseApply the scene’s unit scale factor to exported coordinates
pointCloudbooleangetPointCloud()setPointCloud(boolean)falseExport vertices only (no polygon faces)
verbosebooleangetVerbose()setVerbose(boolean)falseInclude additional OBJ comments in the output
serializeWbooleangetSerializeW()setSerializeW(boolean)falseWrite the W component of control points
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueWrite a .mtl material file and reference it from the .obj
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip 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);
PropertyTypeGetterSetterDefaultDescription
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on import
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseFormat 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);
PropertyTypeGetterSetterDefaultDescription
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.ASCIISet to FileContentType.BINARY to produce a self-contained GLB file; set to FileContentType.ASCII for JSON .gltf with an external buffer
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on export
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseFormat the output JSON with indentation for readability
bufferFilePrefixStringgetBufferFilePrefix()setBufferFilePrefix(String)nullPrefix for external buffer file names
saveExtrasStringgetSaveExtras()setSaveExtras(String)nullCustom 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);
PropertyTypeGetterSetterDefaultDescription
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on import
recalculateNormalbooleangetRecalculateNormal()setRecalculateNormal(boolean)falseRecalculate normals from geometry on import
contentTypeFileContentTypegetContentType()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);
PropertyTypeGetterSetterDefaultDescription
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on export
axisSystemAxisSystemgetAxisSystem()setAxisSystem(AxisSystem)Override the target axis system on export
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.BINARYSet 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);
PropertyTypeGetterSetterDefaultDescription
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseFlip the coordinate system on import

FbxSaveOptions

Note: FBX export is not available in the Java FOSS edition. FBX is supported for import only. The FbxSaveOptions class exists in the API but will produce an error if used to save. Use OBJ, STL, glTF, or GLB for export instead.


See Also