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.


ObjLoadOptions

Läsalternativ för Wavefront OBJ-filer (.obj).

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`    | Vänd koordinatsystemet vid import                       |
| `enableMaterials`      | `boolean`  | `getEnableMaterials()`      | `setEnableMaterials(boolean)`      | `true`     | Läs in den medföljande `.mtl` materialfil               |
| `scale`                | `double`   | `getScale()`                | `setScale(double)`                 | `1.0`      | Enhetlig skala som tillämpas på all importerad geometri |
| `normalizeNormal`      | `boolean`  | `getNormalizeNormal()`      | `setNormalizeNormal(boolean)`      | `true`     | Normalisera importerade normalvektorer till enhetslängd |

---

## ObjSaveOptions

Save‑alternativ för Wavefront OBJ‑filer.



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).

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`    | Vänd koordinatsystemet vid import              |
| `prettyPrint`          | `boolean`  | `getPrettyPrint()`          | `setPrettyPrint(boolean)`          | `false`    | Formatera JSON-utdata med indrag för läsbarhet |

---

## GltfSaveOptions

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

```java
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).

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`    | Vänd koordinatsystemet vid import            |
| `recalculateNormal`    | `boolean`         | `getRecalculateNormal()`    | `setRecalculateNormal(boolean)`    | `false`    | Beräkna om normaler från geometri vid import |
| `contentType`          | `FileContentType` | `getContentType()`          | `setContentType(FileContentType)`  | --         | Tips för binär vs ASCII STL-detektering      |

---

## StlSaveOptions

Sparaalternativ för STL-utdata.



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).

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`    | Vä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

- [Referens för FileFormat-klassen](/3d/java/file-format/)
- [Scene-klassreferens](/3d/java/scene/)
 Svenska