Free Support Forum - aspose.com

Bug while exporting file as DXF

Hello,

I am trying to export files using newest version of Aspose.CAD library (21.1.0). I have a simple code (given below). The only thing I want is to save my file as .dxf. The HUGE bug is that after my file is saved, text formats goes wrong! Instead of having CadText and CadMText elements I received polylines! One polyline describes one letter. Why does my CadText and CadMText exports as polylines? testing file.zip (142.4 KB)

string input = "C://input.dwg";
string result = "C://result.dxf";

using (CadImage cadImage = (CadImage)Image.Load(input))
{
    var options = new DxfOptions()
    {
        VectorRasterizationOptions = new CadRasterizationOptions()
        {
            DrawType = CadDrawTypeMode.UseObjectColor,
            PageHeight = 1600,
            PageWidth = 1600,
            Layouts = new string[] { "Model" }
        }
    };
    cadImage.Save(result, options);
}

@AlexBilakovskyi

I have created a ticket with ID CADNET-1348 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@AlexBilakovskyi

Can you please consider following sample code to export text as text entity instead of lines.

var options = new DxfOptions() {TextAsLines = false}

Thanks for solution!
But for some reason I got an exception (screenshoot attached) while trying to save a file with new option. My code sample works fine without TextAsLines option, but when I try to save image with new options I got an exception. Cad files are the same as given above. Code sample that gives me an error:

string input = "C://input.dwg";
string result = "C://result2.dxf";
using (CadImage cadImage = (CadImage)Image.Load(input))
{
    var options = new DxfOptions()
    {
        VectorRasterizationOptions = new CadRasterizationOptions()
        {
            DrawType = CadDrawTypeMode.UseObjectColor,
            PageHeight = 1600,
            PageWidth = 1600,
            Layouts = new[] { "Model" }
       },
       TextAsLines = false
    };
    cadImage.Save(result, options);
}

image.png (13.1 KB)

@AlexBilakovskyi

If possible, can you please share the source file that is reproducing the issue on your end.

@mudassir.fayyaz

Yes, it’s input.dwg from zip

testing file.zip (142.4 KB)

@AlexBilakovskyi

I have associated information in our issue tracking system and will share the feedback with you as soon as the issue will be addressed.