trace.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Created: 25.03.2011
  2. # Copyright (c) 2011-2018, Manfred Moitzi
  3. # License: MIT License
  4. from ezdxf.legacy import trace
  5. from .graphics import ExtendedTags, DXFAttr, DefSubclass, DXFAttributes, XType
  6. from .graphics import none_subclass, entity_subclass, ModernGraphicEntityExtension
  7. _TRACE_TPL = """0
  8. TRACE
  9. 5
  10. 0
  11. 330
  12. 0
  13. 100
  14. AcDbEntity
  15. 8
  16. 0
  17. 100
  18. AcDbTrace
  19. 10
  20. 0.0
  21. 20
  22. 0.0
  23. 30
  24. 0.0
  25. 11
  26. 0.0
  27. 21
  28. 0.0
  29. 31
  30. 0.0
  31. 12
  32. 0.0
  33. 22
  34. 0.0
  35. 32
  36. 0.0
  37. 13
  38. 0.0
  39. 23
  40. 0.0
  41. 33
  42. 0.0
  43. """
  44. trace_subclass = DefSubclass('AcDbTrace', {
  45. 'vtx0': DXFAttr(10, xtype=XType.any_point),
  46. 'vtx1': DXFAttr(11, xtype=XType.any_point),
  47. 'vtx2': DXFAttr(12, xtype=XType.any_point),
  48. 'vtx3': DXFAttr(13, xtype=XType.any_point),
  49. 'thickness': DXFAttr(39, default=0.0),
  50. 'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0.0, 0.0, 1.0)),
  51. })
  52. class Trace(trace.Trace, ModernGraphicEntityExtension):
  53. __slots__ = ()
  54. TEMPLATE = ExtendedTags.from_text(_TRACE_TPL)
  55. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, trace_subclass)
  56. class Solid(Trace):
  57. __slots__ = ()
  58. TEMPLATE = ExtendedTags.from_text(_TRACE_TPL.replace('TRACE', 'SOLID'))
  59. _3DFACE_TPL = """ 0
  60. 3DFACE
  61. 5
  62. 0
  63. 330
  64. 0
  65. 100
  66. AcDbEntity
  67. 8
  68. 0
  69. 100
  70. AcDbFace
  71. 10
  72. 0.0
  73. 20
  74. 0.0
  75. 30
  76. 0.0
  77. 11
  78. 0.0
  79. 21
  80. 0.0
  81. 31
  82. 0.0
  83. 12
  84. 0.0
  85. 22
  86. 0.0
  87. 32
  88. 0.0
  89. 13
  90. 0.0
  91. 23
  92. 0.0
  93. 33
  94. 0.0
  95. """
  96. face_subclass = DefSubclass('AcDbFace', {
  97. 'vtx0': DXFAttr(10, xtype=XType.point3d),
  98. 'vtx1': DXFAttr(11, xtype=XType.point3d),
  99. 'vtx2': DXFAttr(12, xtype=XType.point3d),
  100. 'vtx3': DXFAttr(13, xtype=XType.point3d),
  101. 'invisible_edge': DXFAttr(70, default=0),
  102. })
  103. class Face(trace.Face, ModernGraphicEntityExtension):
  104. __slots__ = ()
  105. TEMPLATE = ExtendedTags.from_text(_3DFACE_TPL)
  106. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, face_subclass)