Class DxfImportLimitException
- Namespace
- CADability.DXF
- Assembly
- CADability.dll
Thrown by the DXF/DWG import when the INSERTs and DIMENSIONs of the drawing would create more objects than the global setting "DxfDwg.MaxImportObjects" allows (1,000,000 by default; a value of 0 or less also means the default). Every INSERT gets its own copy of its block, so nested blocks multiply, and a small or crafted file could exhaust the memory.
public sealed class DxfImportLimitException : ApplicationException, ISerializable
- Inheritance
-
DxfImportLimitException
- Implements
- Inherited Members
Remarks
It is thrown while the drawing is converted, by Project, and reaches the caller of ReadFromFile(string, string, bool, bool) for "dxf" and "dwg" files directly, never wrapped in another exception. No project is returned.
A caller can catch this type to tell the user that the drawing is too large, using Limit. To import
such a drawing on purpose, raise the setting, e.g. Settings.GlobalSettings.SetValue("DxfDwg.MaxImportObjects", 5000000),
and import the file again; an imported object takes about 650 bytes of memory, and up to 1.6 KB during the import.
It derives from ApplicationException, so handlers written for that type keep catching it.
Properties
Limit
The limit that was exceeded: the value of the setting "DxfDwg.MaxImportObjects" when the import ran, or its default of 1,000,000.
public long Limit { get; }