dxfobjects.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Created: 22.03.2011
  2. # Copyright (c) 2011-2018, Manfred Moitzi
  3. # License: MIT-License
  4. from typing import TYPE_CHECKING
  5. from ezdxf.lldxf.extendedtags import ExtendedTags
  6. from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass, XType
  7. from ezdxf.dxfentity import DXFEntity
  8. if TYPE_CHECKING:
  9. from ezdxf.eztypes import Auditor
  10. none_subclass = DefSubclass(None, {
  11. 'handle': DXFAttr(5),
  12. 'owner': DXFAttr(330),
  13. })
  14. class DXFClass(DXFEntity):
  15. __slots__ = ()
  16. DXFATTRIBS = DXFAttributes(
  17. DefSubclass(None, {
  18. 'name': DXFAttr(1),
  19. 'cpp_class_name': DXFAttr(2),
  20. 'app_name': DXFAttr(3),
  21. 'flags': DXFAttr(90),
  22. 'instance_count': DXFAttr(91, dxfversion='AC1018'),
  23. 'was_a_proxy': DXFAttr(280),
  24. 'is_an_entity': DXFAttr(281),
  25. }),
  26. )
  27. class DXFObject(DXFEntity):
  28. __slots__ = ()
  29. def audit(self, auditor: 'Auditor') -> None:
  30. auditor.check_pointer_target_exists(self, zero_pointer_valid=False)
  31. _PLACEHOLDER_TPL = """0
  32. ACDBPLACEHOLDER
  33. 5
  34. 0
  35. 330
  36. 0
  37. """
  38. class ACDBPlaceHolder(DXFEntity):
  39. __slots__ = ()
  40. TEMPLATE = ExtendedTags.from_text(_PLACEHOLDER_TPL)
  41. DXFATTRIBS = DXFAttributes(none_subclass, )