helix.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Created: 08.04.2018
  2. # Copyright (c) 2018, Manfred Moitzi
  3. # License: MIT-License
  4. from .graphics import ExtendedTags, DXFAttr, DefSubclass, DXFAttributes, XType
  5. from .graphics import none_subclass, entity_subclass
  6. from .spline import Spline, spline_subclass
  7. _HELIX_CLS = """ 0
  8. CLASS
  9. 1
  10. HELIX
  11. 2
  12. AcDbHelix
  13. 3
  14. ObjectDBX Classes
  15. 90
  16. 4095
  17. 91
  18. 0
  19. 280
  20. 0
  21. 281
  22. 1
  23. """
  24. _HELIX_TPL = """0
  25. HELIX
  26. 5
  27. 0
  28. 330
  29. 0
  30. 100
  31. AcDbEntity
  32. 8
  33. 0
  34. 100
  35. AcDbSpline
  36. 70
  37. 0
  38. 71
  39. 3
  40. 72
  41. 0
  42. 73
  43. 0
  44. 74
  45. 0
  46. 100
  47. AcDbHelix
  48. 90
  49. 29
  50. 91
  51. 63
  52. 10
  53. 0.0
  54. 20
  55. 0.0
  56. 30
  57. 0.0
  58. 11
  59. 1.0
  60. 21
  61. 0.0
  62. 31
  63. 0.0
  64. 12
  65. 0.0
  66. 22
  67. 0.0
  68. 32
  69. 1.0
  70. 40
  71. 1.0
  72. 41
  73. 1.0
  74. 42
  75. 1.0
  76. 290
  77. 1
  78. 280
  79. 1
  80. """
  81. helix_subclass = DefSubclass('AcDbHelix', {
  82. 'major_release_number': DXFAttr(90),
  83. 'maintenance_release_number': DXFAttr(91),
  84. 'axis_base_point': DXFAttr(10, xtype=XType.point3d),
  85. 'start_point': DXFAttr(11, xtype=XType.point3d),
  86. 'axis_vector': DXFAttr(12, xtype=XType.point3d),
  87. 'radius': DXFAttr(40),
  88. 'turns': DXFAttr(41),
  89. 'turn_height': DXFAttr(42),
  90. 'handedness': DXFAttr(290), # Handedness: 0=left, 1=right
  91. 'constrain': DXFAttr(280), # Constrain type: 0= Constrain turn height; 1= Constrain turns; 2= Constrain height
  92. })
  93. class Helix(Spline):
  94. # Requires AC1021/R2007
  95. __slots__ = ()
  96. TEMPLATE = ExtendedTags.from_text(_HELIX_TPL)
  97. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, spline_subclass, helix_subclass)
  98. CLASS = ExtendedTags.from_text(_HELIX_CLS)