ray.py 828 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Created: 25.03.2011
  2. # Copyright (c) 2011-2018, Manfred Moitzi
  3. # License: MIT License
  4. from .graphics import ExtendedTags, DXFAttr, DefSubclass, DXFAttributes, XType
  5. from .graphics import none_subclass, entity_subclass, ModernGraphicEntity
  6. _RAY_TPL = """0
  7. RAY
  8. 5
  9. 0
  10. 330
  11. 0
  12. 100
  13. AcDbEntity
  14. 8
  15. 0
  16. 100
  17. AcDbRay
  18. 10
  19. 0.0
  20. 20
  21. 0.0
  22. 30
  23. 0.0
  24. 11
  25. 1.0
  26. 21
  27. 0.0
  28. 31
  29. 0.0
  30. """
  31. ray_subclass = DefSubclass('AcDbRay', {
  32. 'start': DXFAttr(10, xtype=XType.point3d),
  33. 'unit_vector': DXFAttr(11, xtype=XType.point3d),
  34. })
  35. class Ray(ModernGraphicEntity):
  36. __slots__ = ()
  37. TEMPLATE = ExtendedTags.from_text(_RAY_TPL)
  38. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, ray_subclass)
  39. class XLine(Ray):
  40. __slots__ = ()
  41. TEMPLATE = ExtendedTags.from_text(_RAY_TPL.replace('RAY', 'XLINE'))