Tun3dDrawer.py 792 B

12345678910111213141516171819202122232425262728293031
  1. from tqdm import tqdm
  2. from drawer.BaseDrawer import BaseDrawer
  3. from entity.primitives import Tun3d
  4. class Tun3dDrawer(BaseDrawer):
  5. def initialize_data(self):
  6. pass
  7. def draw_agg(self):
  8. assert isinstance(self.obj,Tun3d)
  9. self.draw_plg(self.obj.plg_b.plg_agg,(0,0,0))
  10. self.draw_plg(self.obj.plg_l.plg_agg,self.obj.color)
  11. self.draw_plg(self.obj.plg_r.plg_agg,self.obj.color)
  12. def draw_div(self):
  13. pass
  14. def draw_plg(self,points,color):
  15. hatch = self.msp.add_hatch(dxfattribs={"layer":f"图层{self.obj.layer_id}"})
  16. hatch.rgb = color
  17. edge_path = hatch.paths.add_edge_path()
  18. for i in range(3):
  19. edge_path.add_line(points[i], points[i+1])
  20. edge_path.add_line(points[-1], points[0])