Hi there,
I’m trying to convert a dxf file into a gltf/glb file.
I tried to use the aspose .net examples but the project is outdated and set for .NET 4.0. To access GLTF, we need .NET 6.0. I created a sample project but when I output the GLB/GLTF file, the data is always empty.
using Aspose.CAD;
using Aspose.ThreeD;
using Aspose.ThreeD.Formats;
using License = Aspose.ThreeD.License;
string dataDir = @"c:\dev\temp\aspose\ConsoleApp1\";
License license = new();
license.SetLicense(dataDir + "Aspose.Total.Product.Family.lic");
Aspose.CAD.License cadLicense = new();
cadLicense.SetLicense(dataDir + "Aspose.Total.Product.Family.lic");
try
{
Scene scene = new Scene(dataDir + "conic_pyramid.dxf");
// Instantiate GLTFSaveOptions class object.
GltfSaveOptions saveOptions = new GltfSaveOptions(Aspose.ThreeD.FileFormat.GLTF2);
// OR GLTF2_BINARY
// Set different properties.
saveOptions.EmbedAssets = true;
saveOptions.SaveExtras = true;
// Convert DXF to GLTF GLB file with Save method.
scene.Save(dataDir + "Output.gltf", saveOptions);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
I do not receive any exceptions but I do get an output of 1KB where the glb/gltf is empty.