Free Support Forum - aspose.com

Aspose.CAD.Image


#1

Aspose.CAD.Image Width and Height properties has 0 value.

[TestCase(@“C\input.dwg”)]
public void Test(string inputPath)
{
using (Aspose.CAD.Image cadImage = Aspose.CAD.Image.Load(inputPath))
{
Assert.AreEqual(0, cadImage.Width);
Assert.AreEqual(0, cadImage.Height);
}
}
input.zip (32.1 KB)


#2

@tvv91,

I have worked with the DWG file shared by you and have been able to observe the issue specified. An issue with ID CADNET-734 has been created 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.


#3

@tvv91,

We have investigated the issue on our end. Actually, Model sheet does not contain any entities, so Autocad returns such values about size:

EXTMAX = -1.0000E+20,-1.0000E+20,-1.0000E+20 (read only)
EXTMIN = 1.0000E+20,1.0000E+20,1.0000E+20 (read only)

These values are stored in file (available as Header properties in cadImage) and we retrieve them properly. We internally transform them to zeros correctly because Model sheet is empty (by the way, such values in file may occur not only because of empty sheet). If you want to get size of each sheet, you may use:

foreach (string layoutName in cadImage.Layouts.KeysTyped)
{
CadLayout layout = cadImage.Layouts[layoutName];
double width = layout.MaxExtents.X - layout.MinExtents.X;
double height = layout.MaxExtents.Y - layout.MinExtents.Y;
System.Console.WriteLine("Layout " + layoutName + " has size " + width + "x" + height);
}

which produces such output:

Layout Model has size 0x0
Layout Sheet Form D has size 34,5x23

Please note that previous version Aspose.CAD for .NET 18.8 returned size of the layout instead of Model size. I hope the shared elaboration will be helpful.


#4

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