insert.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Created: 25.03.2011
  2. # Copyright (c) 2011-2018, Manfred Moitzi
  3. # License: MIT License
  4. from ezdxf.legacy import insert
  5. from .graphics import ExtendedTags, DXFAttr, DefSubclass, DXFAttributes, XType
  6. from .graphics import none_subclass, entity_subclass, ModernGraphicEntityExtension
  7. _INSERT_TPL = """0
  8. INSERT
  9. 5
  10. 0
  11. 330
  12. 0
  13. 100
  14. AcDbEntity
  15. 8
  16. 0
  17. 100
  18. AcDbBlockReference
  19. 2
  20. BLOCKNAME
  21. 10
  22. 0.0
  23. 20
  24. 0.0
  25. 30
  26. 0.0
  27. 41
  28. 1.0
  29. 42
  30. 1.0
  31. 43
  32. 1.0
  33. 50
  34. 0.0
  35. """
  36. insert_subclass = DefSubclass('AcDbBlockReference', {
  37. 'attribs_follow': DXFAttr(66, default=0),
  38. 'name': DXFAttr(2),
  39. 'insert': DXFAttr(10, xtype=XType.any_point),
  40. 'xscale': DXFAttr(41, default=1.0),
  41. 'yscale': DXFAttr(42, default=1.0),
  42. 'zscale': DXFAttr(43, default=1.0),
  43. 'rotation': DXFAttr(50, default=0.0),
  44. 'column_count': DXFAttr(70, default=1),
  45. 'row_count': DXFAttr(71, default=1),
  46. 'column_spacing': DXFAttr(44, default=0.0),
  47. 'row_spacing': DXFAttr(45, default=0.0),
  48. 'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0.0, 0.0, 1.0)),
  49. })
  50. class Insert(insert.Insert, ModernGraphicEntityExtension):
  51. __slots__ = ()
  52. TEMPLATE = ExtendedTags.from_text(_INSERT_TPL)
  53. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, insert_subclass)