FileFormat

Methods

FileFormat funge sia da descrittore di formato sia da registro di tutti i formati di file 3D supportati. Ogni formato è rappresentato come un FileFormat istanza accessibile come attributo di classe o tramite metodi factory statici. Si passa FileFormat istanze a Scene.save() per forzare un formato specifico, oppure usare FileFormat.detect() per identificare il formato di un file sconosciuto.

Methods: com.aspose.threed

import com.aspose.threed.FileFormat;

Costanti di Formato Supportate

Le costanti di formato che sono attivamente supportate (importatori e/o esportatori registrati) nella versione FOSS sono mostrate di seguito.

Supportati Attivamente (versione FOSS)

NameTypeAccessDescription
formatsList<FileFormat>ReadGets the formats.
versionVersionReadGets the version.
canImportbooleanReadGets the can import.
canExportbooleanReadGets the can export.
extensionStringReadGets the extension.
extensionsString[]ReadGets the extensions.
contentTypeFileContentTypeReadGets the content type.
fileFormatTypeFileFormatTypeReadGets the file format type.
FBX6100ASCIIFileFormatReadGets the fbx6100 ascii.
FBX6100_BINARYFileFormatReadGets the fbx6100 binary.
FBX7200ASCIIFileFormatReadGets the fbx7200 ascii.
FBX7200_BINARYFileFormatReadGets the fbx7200 binary.
FBX7300ASCIIFileFormatReadGets the fbx7300 ascii.
FBX7300_BINARYFileFormatReadGets the fbx7300 binary.
FBX7400ASCIIFileFormatReadGets the fbx7400 ascii.
FBX7400_BINARYFileFormatReadGets the fbx7400 binary.
FBX7500ASCIIFileFormatReadGets the fbx7500 ascii.
FBX7500_BINARYFileFormatReadGets the fbx7500 binary.
FBX7600ASCIIFileFormatReadGets the fbx7600 ascii.
FBX7600_BINARYFileFormatReadGets the fbx7600 binary.
FBX7700ASCIIFileFormatReadGets the fbx7700 ascii.
FBX7700_BINARYFileFormatReadGets the fbx7700 binary.
MAYAASCIIFileFormatReadGets the mayaascii.
MAYA_BINARYFileFormatReadGets the maya binary.
STL_BINARYFileFormatReadGets the stl binary.
STLASCIIFileFormatReadGets the stlascii.
WAVEFRONTOBJFileFormatReadGets the wavefrontobj.
DISCREET3DSFileFormatReadGets the discreet3 ds.
COLLADAFileFormatReadGets the collada.
UNIVERSAL3DFileFormatReadGets the universal3 d.
GLTFFileFormatReadGets the gltf.
GLTF2FileFormatReadGets the gltf2.
GLTF_BINARYFileFormatReadGets the gltf binary.
GLTF2_BINARYFileFormatReadGets the gltf2 binary.
PDFPdfFormatReadGets the pdf.
BLENDERFileFormatReadGets the blender.
DXFFileFormatReadGets the dxf.
PLYPlyFormatReadGets the ply.
X_BINARYFileFormatReadGets the x binary.
X_TEXTFileFormatReadGets the x text.
DRACODracoFormatReadGets the draco.
MICROSOFT3MFMicrosoft3MFFormatReadGets the microsoft3 mf.
RVM_TEXTRvmFormatReadGets the rvm text.
RVM_BINARYRvmFormatReadGets the rvm binary.
ASEFileFormatReadGets the ase.
IFCFileFormatReadGets the ifc.
SIEMENSJT8FileFormatReadGets the siemensjt8.
SIEMENSJT9FileFormatReadGets the siemensjt9.
AMFFileFormatReadGets the amf.
VRMLFileFormatReadGets the vrml.
ASPOSE3D_WEBFileFormatReadGets the aspose3d web.
HTML5FileFormatReadGets the html5.
ZIPFileFormatReadGets the zip.
USDFileFormatReadGets the usd.
USDAFileFormatReadGets the usda.
USDZFileFormatReadGets the usdz.
XYZFileFormatReadGets the xyz.
PCDFileFormatReadGets the pcd.
PCD_BINARYFileFormatReadGets the pcd binary.

Methods

Versioni FBX 6100-7700 (binario), Maya ASCII/Binario, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binario, PDF, Blender, DXF, PLY, X (binario/testo), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binario.

Metodi Statici

SignatureDescription
FileFormat(type: FileFormatType, version: Version, contentType: FileContentType, extension: String, extensions: String[], canImport: boolean, canExport: boolean)Calls FileFormat(type, version, contentType, extension, extensions, canImport, canExport) on this FileFormat instance.
getFormats()List<FileFormat>Returns the formats.
getVersion()VersionReturns the version.
getFormatByExtension(filePath: String)FileFormatCalls getFormatByExtension(filePath) on this FileFormat instance.
getCanImport()booleanReturns the can import.
getCanExport()booleanReturns the can export.
getExtension()StringReturns the extension.
getExtensions()String[]Returns the extensions.
getContentType()FileContentTypeReturns the content type.
getFileFormatType()FileFormatTypeReturns the file format type.
createLoadOptions()LoadOptionsCalls createLoadOptions on this FileFormat instance.
createSaveOptions()SaveOptionsCalls createSaveOptions on this FileFormat instance.
canDetect(stream: Stream, fileName: String)booleanCalls canDetect(stream, fileName) on this FileFormat instance.
detect(stream: Stream, fileName: String)FileFormatCalls detect(stream, fileName) on this FileFormat instance.
detect(fileName: String)FileFormatCalls detect(fileName) on this FileFormat instance.
registerFormat(format: FileFormat)Calls registerFormat(format) on this FileFormat instance.
toString()StringCalls toString on this FileFormat instance.

Proprietà dell’Istanza

MethodsMethodsMethodsMethods
extensionStringgetExtension()Estensione primaria del file (senza punto iniziale)
extensionsList<String>getExtensions()Tutte le estensioni supportate da questo formato
contentTypeStringgetContentType()Stringa del tipo MIME
canExportbooleangetCanExport()Se l’esportazione in questo formato è supportata
canImportbooleangetCanImport()Se l’importazione da questo formato è supportata
versionStringgetVersion()Stringa della versione del formato

Metodi dell’Istanza

MethodsTipo di ritornoMethods
createLoadOptions()LoadOptionsCrea il formato specifico appropriato LoadOptions sottoclasse
createSaveOptions()SaveOptionsCrea il formato specifico appropriato SaveOptions sottoclasse

Methods

import com.aspose.threed.Scene;
import com.aspose.threed.FileFormat;
import com.aspose.threed.*;

// Auto-detect and load
Scene scene = Scene.fromFile("model.obj");

// Save with explicit format (force GLB binary)
GltfSaveOptions opts = new GltfSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.glb", opts);

// Get format by extension
FileFormat fmt = FileFormat.getFormatByExtension(".fbx");
if (fmt != null) {
    System.out.println(fmt.getCanImport());   // true
    System.out.println(fmt.getCanExport());   // false (FBX export not available)
}

// Create options from a format instance
FileFormat fmtObj = FileFormat.getFormatByExtension(".obj");
LoadOptions loadOpts = fmtObj.createLoadOptions();   // ObjLoadOptions
SaveOptions saveOpts = fmtObj.createSaveOptions();   // ObjSaveOptions

// Detect format from file stream
try (FileInputStream fis = new FileInputStream("unknown_file.bin")) {
    FileFormat detected = FileFormat.detect(fis, "unknown_file.bin");
    if (detected != null) {
        System.out.println(detected.getClass().getSimpleName());
    }
}

Vedi anche

 Italiano