کار با فرمت فایل OBJ
Contents
[
Hide
]Aspose.CAD اکنون از فرمت فایل OBJ پشتیبانی میکند. فرمت فایل OBJ یک هندسه 3 بعدی است که شامل نقشههای بافت، مختصات 3 بعدی، صورتهای چندضلعی و اطلاعات دیگر اشیا است.
صادرات فرمت OBJ به PNG
Aspose.CAD برای جاوا اسکریپت در Angular به توسعه دهندگان این امکان را میدهد که یک فایل OBJ را به فرمت PNG صادر کنند. رویکرد تبدیل OBJ به PNG به صورت زیر عمل میکند:
- بارگذاری فایل ترسیم OBJ با استفاده از روش Image.load.
- فراخوانی Image.save در حالی که یک شی از PngOptions را به عنوان پارامتر دوم منتقل میکنید.
کد نمونه
کد زیر نشان میدهد که چگونه میتوان به همان هدف با استفاده از Aspose.CAD برای جاوا اسکریپت دست یافت.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async onFileSelected(event) { | |
const file: File = event.target.files[0]; | |
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' }); | |
}); | |
} |