3D รูปแบบการแปลงผ่าน C#

แปลงรูปแบบเอกสาร 3D โดยไม่มีซอฟต์แวร์สร้างแบบจำลองและการแสดงผล 3D ใดๆ เพื่อสร้างแอปพลิเคชัน .NET ข้ามแพลตฟอร์ม

 

นักพัฒนาสามารถอ่าน สร้าง แปลง อัปเดต และควบคุมเนื้อหาของรูปแบบ 3D ได้อย่างง่ายดายโดยใช้ไลบรารีกราฟิก 3D รูปแบบที่รองรับบางส่วนโดย API ได้แก่ WavefrontOBJ, Discreet3DS, STL (ASCII, Binary), FBX (ASCII, Binary), Universal3D, Collada, GLB, glTF, PLY, DirectX, Google Draco รูปแบบและอีกมากมาย ขั้นตอนการแปลงทำได้ง่ายเหมือนกับการโหลดไฟล์ต้นฉบับผ่านอินสแตนซ์ของ ฉากคลาส และเรียกเมธอด Save ด้วยพารามิเตอร์รูปแบบเอาต์พุตที่เกี่ยวข้อง

แปลง 3D ฉากเป็นรูปแบบต่างๆ

นักพัฒนาซอฟต์แวร์สามารถแปลง 3D ฉากได้อย่างง่ายดายโดยใช้กระบวนการเดียวกับที่แสดงด้านบน พิจารณาตัวอย่างบางส่วน เช่น FBX ถึง OBJ การแปลง โหลดไฟล์ FBX ผ่านวัตถุ Scene Class สร้างตัวเลือกการบันทึกโดยใช้ ObjSaveOptions และเรียกวิธีบันทึกฉากที่มีเส้นทางไฟล์เอาต์พุตและตัวเลือก obj เป็นพารามิเตอร์ API มีคลาสตัวเลือกที่เหมาะสมสำหรับการบันทึกลงในคลาสที่เกี่ยวข้อง เช่น A3dwSaveOptions AmfSaveOptions Discreet3dsSaveOptions FbxSaveOptions Html5SaveOptions RvmSaveOptions และอื่น ๆ. นี่คือรายการทั้งหมดสำหรับ 3D รูปแบบการแปลง ตัวเลือก. นอกจากนี้ นักพัฒนายังสามารถบันทึกฉาก 3D ลงใน PDF ได้อย่างง่ายดาย

C# โค้ดสำหรับการแปลง FBX ถึง OBJ
// Load the FBX in an object of Scene
var fbxtoObj = new Aspose.ThreeD.Scene("sourceTemplate.fbx");
// create an instance of ObjSaveOptions
var objOptions = new Aspose.ThreeD.Formats.ObjSaveOptions();
// save FBX as a OBJ
fbxtoObj.Save("csharp-fbx-to.obj", objOptions);
C# รหัสสำหรับแปลง 3D ฉากเป็น PDF
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET
// The path to the documents directory.
string MyDir = RunExamples.GetDataDir();
// 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(MyDir + "output_out.pdf", opt);