field.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Created: 08.04.2018
  2. # Copyright (c) 2018, Manfred Moitzi
  3. # License: MIT-License
  4. from .dxfobjects import ExtendedTags, DXFAttr, DefSubclass, DXFAttributes
  5. from .dxfobjects import none_subclass, DXFObject
  6. _FIELD_CLS = """0
  7. CLASS
  8. 1
  9. FIELD
  10. 2
  11. AcDbField
  12. 3
  13. ObjectDBX Classes
  14. 90
  15. 1152
  16. 91
  17. 0
  18. 280
  19. 0
  20. 281
  21. 0
  22. """
  23. _FIELD_TPL = """0
  24. FIELD
  25. 5
  26. 0
  27. 102
  28. {ACAD_REACTORS
  29. 330
  30. 0
  31. 102
  32. }
  33. 330
  34. 0
  35. 100
  36. AcDbField
  37. 1
  38. _text
  39. 2
  40. 90
  41. 0
  42. """
  43. field_subclass = DefSubclass('AcDbField', {
  44. 'evaluator_id': DXFAttr(1),
  45. 'field_code': DXFAttr(2),
  46. 'field_code_overflow': DXFAttr(3), # Overflow of field code string
  47. 'n_child_fields': DXFAttr(90), # Number of child fields
  48. # 360: Child field ID (AcDbHardOwnershipId); repeats for number of children
  49. # 97: Number of object IDs used in the field code
  50. # 331: Object ID used in the field code (AcDbSoftPointerId); repeats for the number of object IDs used in the field code
  51. # 93: Number of the data set in the field
  52. # 6: Key string for the field data; a key-field pair is repeated for the number of data sets in the field
  53. # 7: Key string for the evaluated cache; this key is hard-coded as ACFD_FIELD_VALUE
  54. # 90: Data type of field value
  55. # 91: Long value (if data type of field value is long)
  56. # 140: Double value (if data type of field value is double)
  57. # 330: ID value, AcDbSoftPointerId (if data type of field value is ID)
  58. # 92: Binary data buffer size (if data type of field value is binary)
  59. # 310: Binary data (if data type of field value is binary)
  60. # 301: Format string
  61. # 9: Overflow of Format string
  62. # 98: Length of format string
  63. })
  64. class Field(DXFObject):
  65. __slots__ = ()
  66. # Requires AC1021/R2007
  67. TEMPLATE = ExtendedTags.from_text(_FIELD_TPL)
  68. CLASS = ExtendedTags.from_text(_FIELD_CLS)
  69. DXFATTRIBS = DXFAttributes(none_subclass, field_subclass)