tolerance.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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, ModernGraphicEntity
  6. _TOLERANCE_TPL = """0
  7. TOLERANCE
  8. 5
  9. 0
  10. 330
  11. 0
  12. 100
  13. AcDbEntity
  14. 8
  15. 0
  16. 100
  17. AcDbFcf
  18. 3
  19. STANDARD
  20. 10
  21. 0.0
  22. 20
  23. 0.0
  24. 30
  25. 0.0
  26. 1
  27. 11
  28. 1.0
  29. 21
  30. 0.0
  31. 31
  32. 0.0
  33. """
  34. tolerance_subclass = DefSubclass('AcDbFcf', {
  35. 'dimstyle': DXFAttr(3),
  36. 'insert': DXFAttr(10, xtype=XType.point3d), # Insertion point (in WCS)
  37. 'content': DXFAttr(1), # String representing the visual representation of the tolerance
  38. 'extrusion': DXFAttr(210, xtype=XType.point3d, default=(0, 0, 1)), # Extrusion direction
  39. 'x_axis_vector': DXFAttr(11, xtype=XType.point3d), # X-axis direction vector (in WCS)
  40. })
  41. class Tolerance(ModernGraphicEntity):
  42. # Requires AC1021/R2007
  43. __slots__ = ()
  44. TEMPLATE = ExtendedTags.from_text(_TOLERANCE_TPL)
  45. DXFATTRIBS = DXFAttributes(none_subclass, entity_subclass, tolerance_subclass)