CadImage header data is not saved

Hello,

I try to save some data in CadImage header. CustomProperties should allow me to do this, but when I try to read the header, it turns out that the CustomProperties are empty. My testing code is shown below. Screenshoot added. Maybe I am doing something wrong? I would be grateful for any help.
headerIsEmpty.png (6.0 KB)

using (Image img = Image.Load("C://input.dwg"))
        {
            CadImage cad = img as CadImage;

            cad.Header.CustomProperties.Add("test", "testingValue");

            cad.Save("C://save.dxf", new DxfOptions()
            {
                VectorRasterizationOptions = new CadRasterizationOptions()
                {
                    DrawType = CadDrawTypeMode.UseObjectColor,
                    PageHeight = 1600,
                    PageWidth = 1600
                }
            });
        }

        using (Image img = Image.Load("C://save.dxf"))
        {
            CadImage cad = img as CadImage;

            string value = string.Empty;

            Console.WriteLine(cad.Header.CustomProperties.Count);
            if(cad.Header.CustomProperties.TryGetValue("test", out value))
            {
                Console.WriteLine(value);
            }
        }

@AlexBilakovskyi

Can you please share the source DWG/DXF along with generated output. We will investigate the issue on our end to help you out.

@mudassir.fayyaz

Of course, thank you for reply. Files are attached. I also found out one interesting thing. If I save my file without any options, just using this construction: cad.Save("C://save.dxf"); in output I’ll have damaged file that cannot be opened with AutoCAD or any other CAD viewing tool. But this corrupted file contains all my custom headers. Otherwise, by saving file with DxfOptions (as shown in my first message) I have correct output .dxf file that is readeable by AutoCAD. But the correct file does not containt any custom headers. The best scenario would be receiving readable file with all my headers inside :slight_smile:

SaveWithOptions.zip (27.8 KB)
SaveWithoutOptions.zip (19.6 KB)

Regards,
Alex

@AlexBilakovskyi

Thank you for sharing the information. It seems to be an issue with API. A ticket with ID CADNET-1362 has been created 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.

@mudassir.fayyaz

Thank you for response!

@AlexBilakovskyi

You are always welcome. We will apprise you of developments as soon as the issue will be fixed.

@mudassir.fayyaz

Hi again,

May I ask how this task is going? As I can see it is still in status “new” for now.

@AlexBilakovskyi

At present the task is pending in our issue tracking system for investigation in issues queue. We request for your patience and will share good news with you as soon as it will be fixed.

The issues you have found earlier (filed as CADNET-1362) have been fixed in this update.

@mudassir.fayyaz

Hello,

I was notified that issue CADNET-1362 has been fixed, but using newest version (21.5) of Aspose.CAD library I still cannot run my testing example. Same code as above:

using (Image img = Image.Load("C://input.dwg"))
{
     CadImage cad = img as CadImage;
     cad.Header.CustomProperties.Add("test", "testingValue");
     cad.Save("C://save.dxf", new DxfOptions()
     {
         VectorRasterizationOptions = new CadRasterizationOptions()
         {
             DrawType = CadDrawTypeMode.UseObjectColor,
             PageHeight = 1600,
             PageWidth = 1600
         }
     });
}

using (Image img = Image.Load("C://save.dxf"))
{
    CadImage cad = img as CadImage;
    string value = string.Empty;

    Console.WriteLine(cad.Header.CustomProperties.Count);
    if (cad.Header.CustomProperties.TryGetValue("test", out value))
    {
        Console.WriteLine(value);
    }
}

Maybe I am missing some options params?

image.png (12.9 KB)
input.zip (13.5 KB)

Regards,
Alex

@AlexBilakovskyi

We are sorry for your inconvenience. I have been able to observed the issue in saved DXF file. I have associated the information in our issue tracking system and will share updates with you as soon as they will be shared.