visualstyle.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # Created: 24.11.2018
  2. # Copyright (c) 2018, Manfred Moitzi
  3. # License: MIT-License
  4. from .dxfobjects import DXFAttr, DefSubclass, DXFAttributes, ExtendedTags
  5. from .dxfobjects import none_subclass, DXFObject
  6. _VISUALSTYLE_CLS = """0
  7. CLASS
  8. 1
  9. VISUALSTYLE
  10. 2
  11. AcDbVisualStyle
  12. 3
  13. ObjectDBX Classes
  14. 90
  15. 4095
  16. 91
  17. 26
  18. 280
  19. 0
  20. 281
  21. 0
  22. """
  23. _VISUALSTYLE_TPL = """ 0
  24. VISUALSTYLE
  25. 5
  26. 0
  27. 102
  28. {ACAD_REACTORS
  29. 330
  30. 0
  31. 102
  32. }
  33. 330
  34. 0
  35. 100
  36. AcDbVisualStyle
  37. 2
  38. 2dWireframe
  39. 70
  40. 4
  41. """
  42. visualstyle_subclass = DefSubclass('AcDbVisualStyle', {
  43. 'description': DXFAttr(2),
  44. 'style_type': DXFAttr(70),
  45. 'face_lighting_model': DXFAttr(71),
  46. # 0 =Invisible
  47. # 1 = Visible
  48. # 2 = Phong
  49. # 3 = Gooch
  50. 'face_lighting_quality': DXFAttr(72),
  51. # 0 = No lighting
  52. # 1 = Per face lighting
  53. # 2 = Per vertex lighting
  54. 'face_color_mode': DXFAttr(73),
  55. # 0 = No color
  56. # 1 = Object color
  57. # 2 = Background color
  58. # 3 = Custom color
  59. # 4 = Mono color
  60. # 5 = Tinted
  61. # 6 = Desaturated
  62. 'face_modifiers': DXFAttr(90),
  63. # 0 = No modifiers
  64. # 1 = Opacity
  65. # 2 = Specular
  66. 'face_opacity_level': DXFAttr(40),
  67. 'face_specular_level': DXFAttr(41),
  68. 'color1': DXFAttr(62),
  69. 'color2': DXFAttr(63),
  70. 'face_face_style_mono_color': DXFAttr(421),
  71. 'edge_style_model': DXFAttr(74),
  72. # 0 = No edges
  73. # 1 = Isolines
  74. # 2 = Facet edges
  75. 'edge_style': DXFAttr(91),
  76. 'edge_intersection_color': DXFAttr(64),
  77. 'edge_obscured_color': DXFAttr(65),
  78. 'edge_obscured_linetype': DXFAttr(75),
  79. 'edge_intersection_linetype': DXFAttr(175),
  80. 'edge_crease_angle': DXFAttr(42),
  81. 'edge_modifiers': DXFAttr(92),
  82. 'edge_color': DXFAttr(66),
  83. 'edge_opacity_level': DXFAttr(43),
  84. 'edge_width': DXFAttr(76),
  85. 'edge_overhang': DXFAttr(77),
  86. 'edge_jitter': DXFAttr(78),
  87. 'edge_silhouette_color': DXFAttr(67),
  88. 'edge_silhouette_width': DXFAttr(79),
  89. 'edge_halo_gap': DXFAttr(170),
  90. 'edge_isoline_count': DXFAttr(171),
  91. 'edge_hide_precision': DXFAttr(290), # flag
  92. 'edge_style_apply': DXFAttr(174), # flag
  93. 'style_display_settings': DXFAttr(93),
  94. 'brightness': DXFAttr(44),
  95. 'shadow_type': DXFAttr(173),
  96. })
  97. class VisualStyle(DXFObject):
  98. # Requires AC1021/R2007
  99. __slots__ = ()
  100. TEMPLATE = ExtendedTags.from_text(_VISUALSTYLE_TPL)
  101. CLASS = ExtendedTags.from_text(_VISUALSTYLE_CLS)
  102. DXFATTRIBS = DXFAttributes(none_subclass, visualstyle_subclass)