Load and Save Options

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

Properties

การดำเนินการนำเข้าและส่งออกทั้งหมดรับอ็อบเจ็กต์ options ที่เป็นตัวเลือกเพิ่มเติมซึ่งสืบทอดมาจาก LoadOptions หรือ SaveOptions. ส่งคลาสย่อยที่เหมาะสมไปยัง Scene.open() หรือ Scene.save() เพื่อควบคุมพฤติกรรมที่เฉพาะเจาะจงต่อรูปแบบ.

Properties: com.aspose.threed

import com.aspose.threed.*;

LoadOptions

คลาสฐานสำหรับอ็อบเจ็กต์ load-option ทั้งหมด. Extends A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()รูปแบบที่การกำหนดค่านี้เชื่อมโยงด้วย (อ่านอย่างเดียว)

SaveOptions

คลาสฐานสำหรับอ็อบเจ็กต์ save-option ทั้งหมด. Extends A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()รูปแบบที่การกำหนดค่านี้เชื่อมโยงกับ (อ่านอย่างเดียว)

ObjLoadOptions

ตัวเลือกการโหลดสำหรับไฟล์ Wavefront OBJ (.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)falseพลิกระบบพิกัดเมื่อทำการนำเข้า
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueโหลดไฟล์ที่แนบมาด้วย .mtl ไฟล์วัสดุ
scaledoublegetScale()setScale(double)1.0สเกลแบบสม่ำเสมอที่ใช้กับเรขาคณิตทั้งหมดที่นำเข้า
normalizeNormalbooleangetNormalizeNormal()setNormalizeNormal(boolean)trueทำให้เวกเตอร์ปกติที่นำเข้ามีความยาวเป็นหน่วย

ObjSaveOptions

ตัวเลือกการบันทึกสำหรับไฟล์ Wavefront OBJ.

import com.aspose.threed.*;

ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
applyUnitScalebooleangetApplyUnitScale()setApplyUnitScale(boolean)falseใช้ตัวคูณสเกลหน่วยของฉากกับพิกัดที่ส่งออก
pointCloudbooleangetPointCloud()setPointCloud(boolean)falseส่งออกเฉพาะจุดยอด (ไม่มีหน้าพอลิกอน)
verbosebooleangetVerbose()setVerbose(boolean)falseรวมคอมเมนต์ OBJ เพิ่มเติมในผลลัพธ์
serializeWbooleangetSerializeW()setSerializeW(boolean)falseเขียนส่วนประกอบ W ของจุดควบคุม
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueเขียน a .mtl ไฟล์วัสดุและอ้างอิงจาก the .obj
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseพลิกระบบพิกัดในการส่งออก

GltfLoadOptions

โหลดตัวเลือกสำหรับไฟล์ glTF 2.0 และ GLB (.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)falseพลิกระบบพิกัดในการนำเข้า
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseจัดรูปแบบ JSON ผลลัพธ์ด้วยการเยื้องเพื่อให้อ่านง่าย

GltfSaveOptions

ตัวเลือกการบันทึกสำหรับผลลัพธ์ glTF 2.0 และ GLB.

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.ASCIIตั้งค่าเป็น FileContentType.BINARY เพื่อสร้างไฟล์ GLB ที่เป็นอิสระ; ตั้งค่าเป็น FileContentType.ASCII สำหรับ JSON .gltf พร้อมบัฟเฟอร์ภายนอก
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseพลิกระบบพิกัดเมื่อส่งออก
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseจัดรูปแบบ JSON ผลลัพธ์ด้วยการเยื้องเพื่อให้อ่านง่าย
bufferFilePrefixStringgetBufferFilePrefix()setBufferFilePrefix(String)nullคำนำหน้าสำหรับชื่อไฟล์บัฟเฟอร์ภายนอก
saveExtrasStringgetSaveExtras()setSaveExtras(String)nullข้อมูลพิเศษที่กำหนดเองเพื่อรวมในผลลัพธ์ glTF

StlLoadOptions

ตัวเลือกการโหลดสำหรับไฟล์ STL (.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)falseพลิกระบบพิกัดเมื่อทำการนำเข้า
recalculateNormalbooleangetRecalculateNormal()setRecalculateNormal(boolean)falseคำนวณนอร์มใหม่จากเรขาคณิตเมื่อทำการนำเข้า
contentTypeFileContentTypegetContentType()setContentType(FileContentType)คำแนะนำสำหรับการตรวจจับ STL แบบไบนารีหรือ ASCII

StlSaveOptions

ตัวเลือกการบันทึกสำหรับผลลัพธ์ STL.

import com.aspose.threed.*;

StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseพลิกระบบพิกัดเมื่อทำการส่งออก
axisSystemAxisSystemgetAxisSystem()setAxisSystem(AxisSystem)บังคับใช้ระบบแกนเป้าหมายเมื่อทำการส่งออก
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.BINARYตั้งค่าเป็น BINARY หรือ ASCII เพื่อควบคุมรูปแบบผลลัพธ์

FbxLoadOptions

โหลดตัวเลือกสำหรับไฟล์ FBX (.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)falseพลิกระบบพิกัดเมื่อทำการนำเข้า

FbxSaveOptions

หมายเหตุ: การส่งออก FBX คือ ไม่พร้อมใช้งาน ในรุ่น FOSS ของ Java. FBX รองรับสำหรับการนำเข้าเท่านั้น. The FbxSaveOptions คลาสนี้มีอยู่ใน API แต่จะทำให้เกิดข้อผิดพลาดหากใช้เพื่อบันทึก. ใช้ OBJ, STL, glTF หรือ GLB สำหรับการส่งออกแทน.


ดูเพิ่มเติม

 ภาษาไทย