CADImage.SaveToFile(,EMF,) Exception
Posted: 02 Dec 2014, 20:32
Hi
I have un exception when a try to write a EMF file.
The exception is : "A generic error occurred in GDI+."
I have a trial licence. I'm testing the library.
Please, Can you help me ?
Thank you
I have un exception when a try to write a EMF file.
The exception is : "A generic error occurred in GDI+."
I have a trial licence. I'm testing the library.
Please, Can you help me ?
Thank you
Code: Select all
...
if (cadImage != null)
{
if (cadImage.CurrentLayout == null)
return;
DRect rect = Rectangle(cadImage.CurrentLayout.Entities);
cadImage.SaveToFile("D:Travail\\GDTM\\test.emf", ImageFormat.Emf, rect);
}
...
private static DRect Rectangle(CADEntityCollection entities)
{
double maxX = double.MinValue, maxY = double.MinValue;
double minX = double.MaxValue, minY = double.MaxValue;
int count = entities.Count;
foreach (CADEntity entity in entities)
{
if (entity.EntType == EntityType.Line)
{
DRect box = entity.Box;
maxY = System.Math.Max(maxY, System.Math.Max(box.top, box.bottom));
minY = System.Math.Min(minY, System.Math.Min(box.top, box.bottom));
maxX = System.Math.Max(maxX, System.Math.Max(box.right, box.left));
minX = System.Math.Min(minX, System.Math.Min(box.right, box.left));
}
}
DRect rect = new DRect(minX, minY, maxX, maxY);
return rect;
}