Load and Save Options

Load and Save Options — Aspose.3D FOSS for Java

Properties

Alla import- och exportoperationer accepterar ett valfritt options-objekt som härstammar från LoadOptions eller SaveOptions. Skicka den lämpliga subklassen till Scene.open() eller Scene.save() för att styra format‑specifikt beteende.

Properties: com.aspose.threed

import com.aspose.threed.*;

LoadOptions

Bas-klass för alla load‑option-objekt. Ärver A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()Formatet som denna konfiguration är associerad med (skrivskyddad)

SaveOptions

Bas-klass för alla save‑option-objekt. Ärver A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()Formatet som denna konfiguration är associerad med (skrivskyddad)

ObjLoadOptions

Läsalternativ för Wavefront OBJ-filer (.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);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid import
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueLäs in den medföljande .mtl materialfil
scaledoublegetScale()setScale(double)1.0Enhetlig skala som tillämpas på all importerad geometri
normalizeNormalbooleangetNormalizeNormal()setNormalizeNormal(boolean)trueNormalisera importerade normalvektorer till enhetslängd

ObjSaveOptions

Save‑alternativ för Wavefront OBJ‑filer.

import com.aspose.threed.*;

ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
applyUnitScalebooleangetApplyUnitScale()setApplyUnitScale(boolean)falseTillämpa scenens enhetsskalfaktor på exporterade koordinater
pointCloudbooleangetPointCloud()setPointCloud(boolean)falseExportera endast vertexar (inga polygonytor)
verbosebooleangetVerbose()setVerbose(boolean)falseInkludera ytterligare OBJ-kommentarer i utdata
serializeWbooleangetSerializeW()setSerializeW(boolean)falseSkriv W-komponenten för kontrollpunkterna
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueSkriv en .mtl materialfil och referera till den från the .obj
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid export

GltfLoadOptions

Läsalternativ för glTF 2.0- och GLB-filer (.gltf, .glb).

import com.aspose.threed.*;

GltfLoadOptions opts = new GltfLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("model.gltf", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid import
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseFormatera JSON-utdata med indrag för läsbarhet

GltfSaveOptions

Sparaalternativ för glTF 2.0- och GLB-utdata.

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);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.ASCIIStäll in på FileContentType.BINARY för att producera en självständig GLB-fil; sätt till FileContentType.ASCII för JSON .gltf med en extern buffer
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid export
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseFormatera utdata-JSON med indrag för läsbarhet
bufferFilePrefixStringgetBufferFilePrefix()setBufferFilePrefix(String)nullPrefix för externa bufferfilnamn
saveExtrasStringgetSaveExtras()setSaveExtras(String)nullAnpassade extra data att inkludera i glTF-utdata

StlLoadOptions

Läsalternativ för STL-filer (.stl).

import com.aspose.threed.*;

StlLoadOptions opts = new StlLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("part.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid import
recalculateNormalbooleangetRecalculateNormal()setRecalculateNormal(boolean)falseBeräkna om normaler från geometri vid import
contentTypeFileContentTypegetContentType()setContentType(FileContentType)Tips för binär vs ASCII STL-detektering

StlSaveOptions

Sparaalternativ för STL-utdata.

import com.aspose.threed.*;

StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid export
axisSystemAxisSystemgetAxisSystem()setAxisSystem(AxisSystem)Åsidosätt målaxelsystemet vid export
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.BINARYStäll in på BINARY eller ASCII för att kontrollera utdataformatet

FbxLoadOptions

Läs in alternativ för FBX-filer (.fbx).

import com.aspose.threed.*;

FbxLoadOptions opts = new FbxLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("animation.fbx", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseVänd koordinatsystemet vid import

FbxSaveOptions

Obs: FBX-export är inte tillgänglig i Java FOSS-utgåvan. FBX stöds endast för import. The FbxSaveOptions Klassen finns i API:et men kommer att ge ett fel om den används för att spara. Använd OBJ, STL, glTF eller GLB för export istället.


Se även

 Svenska