datatable.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Created: 08.04.2018
  2. # Copyright (c) 2018, Manfred Moitzi
  3. # License: MIT-License
  4. from .dxfobjects import DXFObject, DefSubclass, DXFAttributes, DXFAttr, none_subclass, ExtendedTags
  5. _DATATABLE_CLS = """0
  6. CLASS
  7. 1
  8. DATATABLE
  9. 2
  10. AcDbDataTable
  11. 3
  12. ObjectDBX Classes
  13. 90
  14. 0
  15. 91
  16. 0
  17. 280
  18. 0
  19. 281
  20. 0
  21. """
  22. _DATATABLE_TPL = """0
  23. DATATABLE
  24. 5
  25. 0
  26. 102
  27. {ACAD_REACTORS
  28. 330
  29. 0
  30. 102
  31. }
  32. 330
  33. 0
  34. 100
  35. AcDbDataTable
  36. 70
  37. 2
  38. 90
  39. 1
  40. 91
  41. 1
  42. 1
  43. TableName
  44. 92
  45. 1
  46. 2
  47. Column1
  48. 93
  49. 0
  50. """
  51. class DataTable(DXFObject):
  52. """
  53. Data storage (non-graphical entity), organized as column, rows table.
  54. Requires DXF version AC1021/R2007
  55. each column start with
  56. 93 >>> start first column
  57. column type
  58. 2
  59. column name
  60. column type >>> first row of first column
  61. value
  62. ... >>> rows-times
  63. ...
  64. 93
  65. column type >>> second column
  66. 2
  67. column name
  68. column type >>> first row of second column
  69. value
  70. ... >>> rows-times
  71. ...
  72. column types:
  73. -------------
  74. undocumented, got info from existing DXF files
  75. 1 entries are integer values (93)
  76. 3 entries are string values (3)
  77. data types:
  78. -----------
  79. 71 boolean values
  80. 93 integer value
  81. 40 double value
  82. 3 string value
  83. 10, 20 30 2d point (30?)
  84. 11, 21, 31 3d point
  85. 331 soft-pointer ID/handle to object value
  86. 360 hard-pointer ownership ID
  87. 340 hard-pointer ID/handle
  88. 330 soft-pointer ID/handle
  89. """
  90. __slots__ = ()
  91. TEMPLATE = ExtendedTags.from_text(_DATATABLE_TPL)
  92. CLASS = ExtendedTags.from_text(_DATATABLE_CLS)
  93. DXFATTRIBS = DXFAttributes(
  94. none_subclass,
  95. DefSubclass('AcDbDataTable', {
  96. 'version': DXFAttr(70),
  97. 'columns': DXFAttr(90),
  98. 'rows': DXFAttr(91),
  99. 'table_name': DXFAttr(1),
  100. }),
  101. )