รูปภาพ STL
Contents
[
Hide
]การส่งออกรูปแบบ STL เป็น PNG
Aspose.CAD สำหรับ .NET ช่วยให้นักพัฒนาสามารถส่งออกไฟล์ STL เป็น PNG ต่อไปนี้คือโค้ดที่แสดงวิธีการเข้าถึงไฟล์ STL และแปลงเป็น PNG โดยใช้ CadRasterizationOption และ PngOptions.
ตัวอย่างโค้ด
This file contains 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
string MyDir = RunExamples.GetDataDir_ConvertingCAD(); | |
string sourceFilePath = MyDir + "galeon.stl"; | |
using (var cadImage = (CadImage)Image.Load(sourceFilePath)) | |
{ | |
var rasterizationOptions = new CadRasterizationOptions(); | |
rasterizationOptions.PageWidth = 100; | |
rasterizationOptions.PageHeight = 100; | |
PngOptions pngOptions = new PngOptions(); | |
pngOptions.VectorRasterizationOptions = rasterizationOptions; | |
string outPath = sourceFilePath + ".png"; | |
cadImage.Save(outPath, pngOptions); | |
} | |
} |