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.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | 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);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
applyUnitScale | boolean | getApplyUnitScale() | setApplyUnitScale(boolean) | false | Tillämpa scenens enhetsskalfaktor på exporterade koordinater |
pointCloud | boolean | getPointCloud() | setPointCloud(boolean) | false | Exportera endast vertexar (inga polygonytor) |
verbose | boolean | getVerbose() | setVerbose(boolean) | false | Inkludera ytterligare OBJ-kommentarer i utdata |
serializeW | boolean | getSerializeW() | setSerializeW(boolean) | false | Skriv W-komponenten för kontrollpunkterna |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | Skriv en .mtl materialfil och referera till den från the .obj |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Vä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);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.ASCII | Stä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 |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Vänd koordinatsystemet vid export |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | Formatera utdata-JSON med indrag för läsbarhet |
bufferFilePrefix | String | getBufferFilePrefix() | setBufferFilePrefix(String) | null | Prefix för externa bufferfilnamn |
saveExtras | String | getSaveExtras() | setSaveExtras(String) | null | Anpassade 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);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | Vänd koordinatsystemet vid export |
axisSystem | AxisSystem | getAxisSystem() | setAxisSystem(AxisSystem) | – | Åsidosätt målaxelsystemet vid export |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.BINARY | Stä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/)