dimassoc.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # Created: 15.04.2018
  2. # Copyright (c) 2018, Manfred Moitzi
  3. # License: MIT-License
  4. from .dxfobjects import DXFObject, DefSubclass, DXFAttributes, DXFAttr, XType, none_subclass, ExtendedTags
  5. # Autodesk gone crazy: subclass AcDbOsnapPointRef with group code 1!!!!!
  6. _DIMASSOC_CLS = """0
  7. CLASS
  8. 1
  9. DIMASSOC
  10. 2
  11. AcDbDimAssoc
  12. 3
  13. "AcDbDimAssoc|Product Desc: AcDim ARX App For Dimension|Company: Autodesk, Inc.|WEB Address: www.autodesk.com"
  14. 90
  15. 0
  16. 91
  17. 4
  18. 280
  19. 0
  20. 281
  21. 0
  22. """
  23. _DIMASSOC_TPL = """0
  24. DIMASSOC
  25. 5
  26. 0
  27. 102
  28. {ACAD_REACTORS
  29. 330
  30. 0
  31. 102
  32. }
  33. 330
  34. 0
  35. 100
  36. AcDbDimAssoc
  37. 330
  38. 0
  39. 90
  40. 1
  41. 70
  42. 0
  43. 71
  44. 0
  45. 1
  46. AcDbOsnapPointRef
  47. 72
  48. 0
  49. 331
  50. 0
  51. 73
  52. 0
  53. 91
  54. 0
  55. 40
  56. 0.0
  57. 10
  58. 0.0
  59. 20
  60. 0.0
  61. 30
  62. 0.0
  63. 75
  64. 0
  65. """
  66. class DimAssoc(DXFObject):
  67. # requires AC1015/R2000
  68. # DIMASSOC objects implement associative dimensions by specifying an association between a dimension object and
  69. # drawing geometry objects. An associative dimension is a dimension that will automatically update when the
  70. # associated geometry is modified.
  71. __slots__ = ()
  72. TEMPLATE = ExtendedTags.from_text(_DIMASSOC_TPL)
  73. CLASS = ExtendedTags.from_text(_DIMASSOC_CLS)
  74. DXFATTRIBS = DXFAttributes(none_subclass, DefSubclass('AcDbDimAssoc', {
  75. 'dimension': DXFAttr(330), # handle of dimension object
  76. 'point_flag': DXFAttr(90), # Associativity flag (bit-coded)
  77. # 1 = First point reference
  78. # 2 = Second point reference
  79. # 4 = Third point reference
  80. # 8 = Fourth point reference
  81. 'trans_space': DXFAttr(70), # Trans-space flag (true/false)
  82. 'rotated_dim_type': DXFAttr(71), # Rotated Dimension type (parallel, perpendicular)
  83. # Autodesk gone crazy: subclass AcDbOsnapPointRef with group code 1!!!!!
  84. # }), DefSubclass('AcDbOsnapPointRef', {
  85. 'osnap_type': DXFAttr(72), # Object Osnap type
  86. # 0 = None
  87. # 1 = Endpoint
  88. # 2 = Midpoint
  89. # 3 = Center
  90. # 4 = Node
  91. # 5 = Quadrant
  92. # 6 = Intersection
  93. # 7 = Insertion
  94. # 8 = Perpendicular
  95. # 9 = Tangent
  96. # 10 = Nearest
  97. # 11 = Apparent intersection
  98. # 12 = Parallel
  99. # 13 = Start point
  100. 'object_id': DXFAttr(331), # ID of main object (geometry)
  101. 'object_subtype': DXFAttr(73), # SubentType of main object (edge, face)
  102. 'object_gs_marker': DXFAttr(91), # GsMarker of main object (index)
  103. 'object_xref_id': DXFAttr(301), # Handle (string) of Xref object
  104. 'near_param': DXFAttr(40), # Geometry parameter for Near Osnap
  105. 'osnap_point': DXFAttr(10, xtype=XType.point3d), # Osnap point in WCS
  106. 'intersect_id': DXFAttr(332), # ID of intersection object (geometry)
  107. 'intersect_subtype': DXFAttr(74), # SubentType of intersection object (edge/face)
  108. 'intersect_gs_marker': DXFAttr(92), # GsMarker of intersection object (index)
  109. 'intersect_xref_id': DXFAttr(302), # Handle (string) of intersection Xref object
  110. 'has_last_point_ref': DXFAttr(75), # hasLastPointRef flag (true/false)
  111. }))