FileFormat — Aspose.3D FOSS for Python API Reference

Example

FileFormat 포맷 설명자이자 지원되는 모든 3D 파일 포맷의 레지스트리 역할을 합니다. 각 포맷은 a FileFormat 클래스 속성으로 접근하거나 정적 팩토리 메서드를 통해 접근 가능한 인스턴스입니다. 당신은 FileFormat 인스턴스를 to Scene.save() 특정 포맷을 강제하거나, 사용 to FileFormat.detect() 알 수 없는 파일의 포맷을 식별합니다.

Example: aspose.threed

from aspose.threed import FileFormat

지원되는 형식 상수

FOSS 릴리스에서 실제로 지원되는(임포터 및/또는 익스포터가 등록된) 포맷 상수는 아래에 표시됩니다. 소스에 None 소스에 있는 상수는 아직 구현되지 않은 포맷에 대한 예약된 이름입니다.

실제 지원됨 (FOSS 릴리스)

ExampleExampleExample
FileFormat.WAVEFRONT_OBJ().obj인스턴스를 반환하는 정적 메서드 ObjFormat 인스턴스
FileFormat.GLTF2().gltf / .glbglTF 2.0; 인스턴스를 반환하는 정적 메서드 GltfFormat 인스턴스
FileFormat.FBX7400ASCII().fbxFBX 7.4 ASCII; 정적 메서드
FileFormat.MICROSOFT_3MF.3mf3MF (set at module load)
FileFormat.COLLADA.daeExample
FileFormat.STL_BINARY.stlSTL 바이너리(모듈 로드 시 설정)
FileFormat.STLASCII.stlSTL ASCII

Example

FBX versions 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.

정적 메서드

Example반환 타입Example
FileFormat.detect(stream, file_name)`FileFormatNone`
FileFormat.get_format_by_extension(ext)`FileFormatNone`

인스턴스 속성

ExampleExampleExample
extensionstr주요 파일 확장자(선행 점 없이)
extensionslist[str]이 형식이 지원하는 모든 확장자
content_typestrMIME 타입 문자열
can_exportbool이 형식으로 내보내기가 지원되는지 여부
can_importbool이 형식에서 가져오기가 지원되는지 여부
versionstr형식 버전 문자열

인스턴스 메서드

Example반환 유형Example
create_load_options()LoadOptions적절한 형식에 맞는 것을 생성합니다 LoadOptions 서브클래스
create_save_options()SaveOptions적절한 형식에 맞는 것을 생성합니다 SaveOptions 서브클래스

Example

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

참고

 한국어