การสร้างภาพ STL
Contents
[
Hide
]การส่งออก STL เป็นรูปแบบ PNG
Aspose.CAD สำหรับ Java อนุญาตให้นักพัฒนาส่งออกไฟล์ STL เป็น PNG ด้านล่างเป็นโค้ดที่แสดงวิธีการเข้าถึงไฟล์ STL และแปลงเป็น PNG โดยใช้ CadRasterizationOption และ PngOptions.
โค้ดตัวอย่าง
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
String dataDir = Utils.getDataDir(ExportSTLToPNG.class) + "ExportingSTL/"; | |
String fileName = dataDir + "example.stl"; | |
CadImage cadImage = (CadImage)Image.load(fileName); | |
CadRasterizationOptions vectorOptions = new CadRasterizationOptions(); | |
vectorOptions.setPageWidth(1500); | |
vectorOptions.setPageHeight(1500); | |
PngOptions pngOptions = new PngOptions(); | |
//pngOptions.setVectorRasterizationOptions(rasterizationOptions); | |
String outPath = dataDir + "galeon.stl.png"; | |
cadImage.save(outPath, pngOptions); | |