Pubblico API Modifiche nel Aspose.3D 16.9.0

Contenuto sommario

Importazione 3D Scena dalla fonte PDF

Utilizzando la versione recente (16.9.0) o superiore, gli sviluppatori possono recuperare 3D scene da un file di input PDF.

Aggiunge Aspose.ThreeD. Formati. Classe PdfLoadOptions

Abbiamo aggiunto la classe PdfLoadOptions. Aiuta a caricare il contenuto dal file di input PDF. Gli sviluppatori possono applicare la password per i PDF protetti.

Apri la scena da un file PDF protetto da password

 // set path with filename and extension 

string path = @"House_Design.pdf";

// create a new scene

Scene scene = new Scene();

// use loading options and apply password

PdfLoadOptions opt = new PdfLoadOptions() {Password = Encoding.UTF8.GetBytes("password")};

// open scene

scene.Open(path, opt);

Aggiunge Aspose.ThreeD.FileFormat e Aspose.ThreeD.Formats.PdfFormat Class

Abbiamo aggiunto una voce del formato PDF nella classe FileFormat a scopo di caricamento e salvataggio. La classe PdfFormat aiuta a manipolare i PDF.

 public static readonly Aspose.ThreeD.Formats.PdfFormat PDF;

Estrai tutti i contenuti crudi 3D dal file PDF

 // set PDF file path and password

string path = @"House_Design.pdf";

byte[]password = null;

// extract 3D contents

List<byte[]> contents = FileFormat.PDF.Extract(path, password);

int i = 1;

// iterate through the contents and in separate 3D files

foreach (byte[]content in contents)

{

    string fileName = "3d-" + (i++);

    File.WriteAllBytes(fileName, content);

}

Estrarre tutte le scene 3D e salvarle in un file FBX

 // set PDF file path and password

string path = @"House_Design.pdf";

byte[]password = null;

List<Scene> scenes = FileFormat.PDF.ExtractScene(path, password);

int i = 1;

// iterate through the scenes and save in 3D files

foreach (Scene scene in scenes)

{

    string fileName = "3d-" + (i++) + ".fbx";

    scene.Save(fileName, FileFormat.FBX7400ASCII);

}

Salva una scena 3D nel formato PDF

Utilizzando la versione recente (16.9.0) o superiore, gli sviluppatori possono salvare tutti i file 3D supportati nel formato PDF.

Aggiunge Aspose.ThreeD. Formati. Classe PdfSaveOptions e Aspose.ThreeD. Formati. PdfLightingScheme/PdfRenderMode Enums

PdfSaveOptions aiuta ad applicare l’impostazione prima di salvare nel formato di output PDF. Gli sviluppatori possono impostare una modalità di rendering e uno schema di illuminazione prima di salvare una scena 3D nel formato PDF come di seguito:

Crea uno 3D PDF con un cilindro e renderizzato in modalità illustrazione ombreggiata con illuminazione ottimizzata CAD

 // create a new scene

Scene scene = new Scene();

// create a cylinder child node

scene.RootNode.CreateChildNode("cylinder", new Cylinder()).Material = new PhongMaterial() { DiffuseColor = new Vector3(Color.DarkCyan)};

// set rendering mode and lighting scheme

PdfSaveOptions opt = new PdfSaveOptions();

opt.LightingScheme = PdfLightingScheme.CAD;

opt.RenderMode = PdfRenderMode.ShadedIllustration;

// save in the PDF format

scene.Save("output.pdf", opt);

Aggiunge il metodo triangolato nella classe Aspose.ThreeD.Entities.PolygonModifier

Abbiamo aggiunto un altro sovraccarico del metodo Triangulate nella classe PolygonModifier che prende un oggetto classe Scene come parametro.

Convertire tutti i poligoni in triangoli nel file FBX

 // load an existing 3D file

Scene scene = new Scene("original.fbx");

// triangulate a scene

PolygonModifier.Triangulate(scene);

// save 3D scene

scene.Save("triangulated.fbx", FileFormat.FBX7400ASCII);

Aggiunge due metodi BuildTangentBinormal nella classe Aspose.ThreeD.Entities.PolygonModifier

Abbiamo aggiunto due metodi BuildTangentBinormal nella classe PolygonModifier. Un metodo prende l’oggetto classe Scene come parametro e un altro prende l’oggetto classe Mesh come parametro.

Costruisci dati tangenti e binormali per tutte le mesh nel file FBX

 // load an existing 3D file

Scene scene = new Scene("original.fbx");

// triangulate a scene

PolygonModifier.BuildTangentBinormal(scene);

// save 3D scene

scene.Save("output.fbx", FileFormat.FBX7400ASCII);