Load and Save Options — Aspose.3D FOSS for Python API Reference
การดำเนินการนำเข้าและส่งออกทั้งหมดรับอ็อบเจ็กต์ options ทางเลือกที่สืบทอดมาจาก LoadOptions หรือ SaveOptions. ส่งคลาสย่อยที่เหมาะสมไปยัง Scene.open() หรือ Scene.save() เพื่อควบคุมพฤติกรรมที่เฉพาะเจาะจงของรูปแบบ.
: aspose.threed.formats
from aspose.threed.formats import (
LoadOptions, SaveOptions,
ObjLoadOptions, ObjSaveOptions,
GltfLoadOptions, GltfSaveOptions,
StlLoadOptions, StlSaveOptions,
FbxLoadOptions, FbxSaveOptions,
ColladaLoadOptions, ColladaSaveOptions,
ThreeMfLoadOptions, ThreeMfSaveOptions,
)LoadOptions และ SaveOptions สืบทอดจาก IOConfig. คุณสมบัติดังต่อไปนี้พร้อมใช้งานในอ็อบเจ็กต์ options ทุกอ็อบเจ็กต์.file_format | `FileFormat | None` |
encoding | `str | None` |
file_system | `FileSystem | None` |
lookup_paths | list[str] | ไดเรกทอรีเพิ่มเติมเพื่อค้นหาเมื่อแก้ไขการอ้างอิงภายนอก |
file_name | `str | None` |
LoadOptions
คลาสฐานสำหรับอ็อบเจ็กต์ตัวเลือกการโหลดทั้งหมด.
คุณสมบัติเพิ่มเติม (นอกเหนือจาก IOConfig):
encoding | `str | None` |
SaveOptions
คลาสฐานสำหรับอ็อบเจ็กต์ตัวเลือกการบันทึกทั้งหมด.
คุณสมบัติเพิ่มเติม (นอกเหนือจาก IOConfig):
export_textures | bool | True, texture ที่อ้างอิงโดยฉากจะถูกคัดลอกไปยังผลลัพธ์ ค่าเริ่มต้นคือ False |
ObjLoadOptions
ตัวเลือกการโหลดสำหรับไฟล์ Wavefront OBJ (.obj).
from aspose.threed.formats import ObjLoadOptions
opts = ObjLoadOptions()
opts.flip_coordinate_system = True
opts.scale = 0.01
scene = Scene()
scene.open("model.obj", opts)flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อทำการนำเข้า |
enable_materials | bool | True | โหลดไฟล์ที่แนบมาด้วย .mtl ไฟล์ material |
scale | float | 1.0 | สเกลสม่ำเสมอที่ใช้กับเรขาคณิตที่นำเข้าทั้งหมด |
normalize_normal | bool | True | ทำให้เวกเตอร์ปกติที่นำเข้ามีความยาวเป็นหน่วย |
ObjSaveOptions
ตัวเลือกการบันทึกสำหรับไฟล์ Wavefront OBJ.
from aspose.threed.formats import ObjSaveOptions
opts = ObjSaveOptions()
opts.enable_materials = False
scene.save("output.obj", opts)apply_unit_scale | bool | False | ใช้ปัจจัยสเกลหน่วยของซีนกับพิกัดที่ส่งออก |
point_cloud | bool | False | ส่งออก vertices เท่านั้น (ไม่มี polygon faces) |
verbose | bool | False | รวมคอมเมนต์ OBJ เพิ่มเติมในผลลัพธ์ |
serialize_w | bool | False | เขียนส่วนประกอบ W ของ control points |
enable_materials | bool | True | เขียน a .mtl ไฟล์ material และอ้างอิงจาก .obj |
flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อส่งออก |
axis_system | `AxisSystem | None` | None |
GltfLoadOptions
ตัวเลือกการโหลดสำหรับไฟล์ glTF 2.0 และ GLB (.gltf, .glb).
from aspose.threed.formats import GltfLoadOptions
opts = GltfLoadOptions()
opts.flip_tex_coord_v = False
scene = Scene()
scene.open("model.gltf", opts)flip_tex_coord_v | bool | True | พลิกพิกัดเทกเจอร์ V เมื่อทำการนำเข้า (glTF ใช้จุดกำเนิดด้านบนซ้าย; True แปลงเป็นด้านล่างซ้าย) |
GltfSaveOptions
ตัวเลือกการบันทึกสำหรับผลลัพธ์ glTF 2.0.
from aspose.threed.formats import GltfSaveOptions
opts = GltfSaveOptions()
opts.binary_mode = True # produce a .glb file
scene.save("output.glb", opts)binary_mode | bool | False | True, เขียน GLB ไบนารีแบบอิสระ; เมื่อ False, เขียน JSON .gltf ด้วยบัฟเฟอร์ภายนอก |
flip_tex_coord_v | bool | True | พลิกพิกัดเทกเจอร์ V ขณะส่งออก |
export_textures | bool | False | คัดลอกเทกเจอร์ที่อ้างอิงไปยังแพ็กเกจผลลัพธ์ (สืบทอดจาก SaveOptions) |
StlLoadOptions
ตัวเลือกการโหลดสำหรับไฟล์ STL (.stl).
from aspose.threed.formats import StlLoadOptions
opts = StlLoadOptions()
opts.scale = 0.001 # convert millimetres to metres
scene = Scene()
scene.open("part.stl", opts)flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อทำการนำเข้า |
scale | float | 1.0 | สเกลแบบสม่ำเสมอที่ใช้กับเรขาคณิตที่นำเข้า |
StlSaveOptions
ตัวเลือกการบันทึกสำหรับผลลัพธ์ STL.
from aspose.threed.formats import StlSaveOptions
opts = StlSaveOptions()
opts.binary_mode = True
scene.save("output.stl", opts)flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อทำการส่งออก |
scale | float | 1.0 | สเกลแบบสม่ำเสมอที่ใช้กับเรขาคณิตที่ส่งออก |
binary_mode | bool | False | เขียนเป็น STL แบบไบนารีแทน STL แบบ ASCII |
FbxLoadOptions
ตัวเลือกการโหลดสำหรับไฟล์ FBX (.fbx).
from aspose.threed.formats import FbxLoadOptions
opts = FbxLoadOptions()
opts.keep_builtin_global_settings = True
scene = Scene()
scene.open("animation.fbx", opts)keep_builtin_global_settings | bool | False | คงรักษา FBX GlobalSettings คุณสมบัติในข้อมูลสินทรัพย์ของฉาก |
compatible_mode | bool | False | เปิดใช้งานโหมดความเข้ากันได้สำหรับไฟล์ FBX จากเครื่องมือสร้างรุ่นเก่า |
FbxSaveOptions
ตัวเลือกการบันทึกสำหรับการส่งออก FBX.
from aspose.threed.formats import FbxSaveOptions
opts = FbxSaveOptions()
opts.enable_compression = False
scene.save("output.fbx", opts)export_textures | bool | False | คัดลอกเทกเจอร์ที่อ้างอิงไปยังไดเรกทอรีผลลัพธ์ |
reuse_primitive_mesh | bool | False | กำจัดการทำซ้ำของเรขาคณิตเมชที่เหมือนกันในผลลัพธ์ |
enable_compression | bool | True | เปิดใช้งานการบีบอัดภายในแบบไบนารีของ FBX |
fold_repeated_curve_data | None | พับส่วนโค้งแอนิเมชันที่เหมือนกัน | |
export_legacy_material_properties | bool | True | รวมถึงรุ่นเก่า Phong/Lambert โหนดคุณสมบัติวัสดุสำหรับความเข้ากันได้ |
video_for_texture | bool | False | ฝังข้อมูลเทกเจอร์ในโหนดวิดีโอของ FBX |
embed_textures | bool | False | ฝังไฟล์เทกเจอร์แบบอินไลน์ในไบนารี FBX |
generate_vertex_element_material | bool | False | เพิ่ม VertexElementMaterial ชั้นสำหรับการกำหนดวัสดุต่อพอลิกอน |
ColladaLoadOptions
ตัวเลือกการโหลดสำหรับไฟล์ COLLADA (.dae).
from aspose.threed.formats import ColladaLoadOptions
opts = ColladaLoadOptions()
opts.scale = 0.01
scene = Scene()
scene.open("model.dae", opts)flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อทำการนำเข้า |
enable_materials | bool | True | นำเข้าการกำหนดวัสดุ COLLADA |
scale | float | 1.0 | สเกลแบบสม่ำเสมอที่ใช้กับเรขาคณิตที่นำเข้า |
normalize_normal | bool | True | ทำให้เวกเตอร์ปกติที่นำเข้ามาเป็นมาตรฐาน |
ColladaSaveOptions
ตัวเลือกการบันทึกสำหรับการส่งออก COLLADA.
from aspose.threed.formats import ColladaSaveOptions
opts = ColladaSaveOptions()
opts.indented = False # compact output
scene.save("output.dae", opts)flip_coordinate_system | bool | False | พลิกระบบพิกัดเมื่อทำการส่งออก |
enable_materials | bool | True | เขียนการกำหนดวัสดุ COLLADA |
indented | bool | True | พิมพ์ XML อย่างสวยงามพร้อมการเยื้องบรรทัด |
ThreeMfLoadOptions / ThreeMfSaveOptions
ตัวเลือกการโหลดและบันทึกสำหรับไฟล์ 3MF (.3mf).
from aspose.threed.formats import ThreeMfLoadOptions, ThreeMfSaveOptions
# Load
load_opts = ThreeMfLoadOptions()
scene = Scene()
scene.open("part.3mf", load_opts)
# Save
save_opts = ThreeMfSaveOptions()
scene.save("output.3mf", save_opts)คลาสเหล่านี้สืบทอดคุณสมบัติพื้นฐานจาก LoadOptions / SaveOptions ตามลำดับ ไม่มีคุณสมบัติเฉพาะรูปแบบเพิ่มเติมที่ถูกบันทึกไว้สำหรับการปล่อย FOSS ปัจจุบัน.