dxffactory.py 536 B

12345678910111213141516171819
  1. # Purpose: dxf-factory-factory
  2. # Created: 11.03.2011
  3. # Copyright (C) 2011, Manfred Moitzi
  4. # License: MIT License
  5. from typing import TYPE_CHECKING
  6. from ezdxf.legacy import LegacyDXFFactory
  7. from ezdxf.modern import ModernDXFFactory
  8. if TYPE_CHECKING:
  9. from ezdxf.eztypes import DXFFactoryType, Drawing
  10. def dxffactory(drawing: 'Drawing') -> 'DXFFactoryType':
  11. dxfversion = drawing.dxfversion
  12. factory_class = LegacyDXFFactory if dxfversion <= 'AC1009' else ModernDXFFactory
  13. return factory_class(drawing)