نقاشی‌های STL

صادر کردن فرمت STL به PNG

Aspose.CAD برای جاوا اسکریپت در Angular به توسعه‌دهندگان این امکان را می‌دهد که یک فایل STL را به فرمت PNG صادر کنند. روش تبدیل STL به PNG به شرح زیر کار می‌کند:

  1. فایل نقاشی STL را با استفاده از روش Image.load بارگذاری کنید.
  2. از Image.save با گذراندن یک شیء از PngOptions به عنوان پارامتر دوم استفاده کنید.

کد نمونه

کد زیر نشان می‌دهد که چگونه می‌توان به هدف مشابهی با استفاده از Aspose.CAD برای جاوا اسکریپت دست یافت

async onFileSelected(event) {
const file: File = event.target.files[0]; //file.stl
file.arrayBuffer().then(async buff => {
let x = new Uint8Array(buff);
this.imgFile = await Image.load(x);
var exportedFile = await Image.save(this.imgFile, new PngOptions());
var blob = new Blob([exportedFile], { type: 'application/octet-stream' });
});
}