FileFormat
Methods
FileFormat 포맷 설명자이자 지원되는 모든 3D 파일 포맷의 레지스트리 역할을 합니다. 각 포맷은 FileFormat 클래스 속성으로 접근하거나 정적 팩토리 메서드를 통해 접근 가능한 인스턴스입니다. 당신은 FileFormat 인스턴스를 Scene.save() 특정 포맷을 강제하기 위해, 혹은 사용하기 위해 FileFormat.detect() 알 수 없는 파일의 형식을 식별하기 위해.
Methods: aspose.threed
from aspose.threed import FileFormat지원되는 포맷 상수
FOSS 릴리스에서 적극적으로 지원되는(등록된 가져오기/내보내기 도구) 형식 상수는 아래에 표시됩니다. 다음과 같이 나열된 상수는 None 소스에 있는 경우 아직 구현되지 않은 형식에 대한 예약된 이름입니다.
실제 지원됨 (FOSS 릴리스)
| Methods | Methods | Methods |
|---|---|---|
FileFormat.WAVEFRONT_OBJ() | .obj | 정적 메서드가 반환하는 ObjFormat 인스턴스 |
FileFormat.GLTF2() | .gltf / .glb | glTF 2.0; 반환하는 정적 메서드 GltfFormat 인스턴스 |
FileFormat.FBX7400ASCII() | .fbx | FBX 7.4 ASCII; 정적 메서드 |
FileFormat.MICROSOFT_3MF | .3mf | 3MF (set at module load) |
FileFormat.COLLADA | .dae | Methods |
FileFormat.STL_BINARY | .stl | STL binary (모듈 로드 시 설정) |
FileFormat.STLASCII | .stl | STL ASCII |
Methods
FBX 버전 6100–7700 (binary), Maya ASCII/Binary, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binary, PDF, Blender, DXF, PLY, X (binary/text), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binary.
정적 메서드
| Methods | 반환 타입 | Methods |
|---|---|---|
FileFormat.detect(stream, file_name) | `FileFormat | None` |
FileFormat.get_format_by_extension(ext) | `FileFormat | None` |
인스턴스 속성
| Methods | Methods | Methods |
|---|---|---|
extension | str | 주 파일 확장자 (점 없이) |
extensions | list[str] | 이 포맷이 지원하는 모든 확장자 |
content_type | str | MIME 타입 문자열 |
can_export | bool | 이 형식으로 내보내기가 지원되는지 여부 |
can_import | bool | 이 형식에서 가져오기가 지원되는지 여부 |
version | str | 형식 버전 문자열 |
인스턴스 메서드
| Methods | 반환 유형 | Methods |
|---|---|---|
create_load_options() | LoadOptions | 적절한 형식에 특화된 것을 생성합니다 LoadOptions 서브클래스 |
create_save_options() | SaveOptions | 적절한 형식에 특화된 것을 생성합니다 SaveOptions 서브클래스 |
Methods
from aspose.threed import Scene, FileFormat
# Auto-detect and load
scene = Scene.from_file("model.obj")
# Save with explicit format (force GLB binary)
from aspose.threed.formats import GltfSaveOptions
opts = GltfSaveOptions()
opts.binary_mode = True
scene.save("output.glb", opts)
# Get format by extension
fmt = FileFormat.get_format_by_extension(".fbx")
if fmt:
print(fmt.can_import) # True
print(fmt.can_export) # True
# Create options from a format instance
fmt_obj = FileFormat.get_format_by_extension(".obj")
load_opts = fmt_obj.create_load_options() # ObjLoadOptions
save_opts = fmt_obj.create_save_options() # ObjSaveOptions
# Detect format from file stream
with open("unknown_file.bin", "rb") as f:
detected = FileFormat.detect(f, "unknown_file.bin")
if detected:
print(type(detected).__name__)