tun_gap_drawer.py 726 B

123456789101112131415161718192021222324252627282930
  1. from drawer.BaseDrawer import BaseDrawer
  2. from entity.primitives import Tun3d, TunGap
  3. class TunGapDrawer(BaseDrawer):
  4. def initialize_data(self):
  5. self.obj.layer_id = 1
  6. def draw_agg(self):
  7. assert isinstance(self.obj,TunGap)
  8. self.draw_gap(self.obj.plg.plg_agg)
  9. def draw_div(self):
  10. pass
  11. def draw_gap(self,point_list):
  12. hatch = self.msp.add_hatch(dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  13. hatch.rgb = (0, 0, 0)
  14. edge_path = hatch.paths.add_edge_path()
  15. for i in range(len(point_list)):
  16. if i+1<len(point_list): edge_path.add_line(point_list[i], point_list[i + 1])
  17. edge_path.add_line(point_list[-1], point_list[0])