fan_local_drawer.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import math
  2. import core
  3. from drawer.BaseDrawer import VentGraphDrawer
  4. class FanLocalDrawer(VentGraphDrawer):
  5. def initialize_data(self):
  6. pass
  7. def draw_obj(self,center,route):
  8. rad = 0.5 * self.obj.width
  9. self.msp.add_circle(center=center, radius=rad, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  10. a1 = center[0], center[1] + rad
  11. a2 = center[0], center[1] + rad * 3 / 2
  12. a3 = center[0] + rad * 1 / 2, center[1] + rad * 3 / 2
  13. a1 = core.rotate_point_around_another(a1, center, route)
  14. a2 = core.rotate_point_around_another(a2, center, route)
  15. a3 = core.rotate_point_around_another(a3, center, route)
  16. self.msp.add_line(a1, a2, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  17. self.msp.add_line(a2, a3, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  18. a4 = core.rotate_point_around_another(a1, center, -2/3*math.pi)
  19. a5 = core.rotate_point_around_another(a2, center, -2/3*math.pi)
  20. a6 = core.rotate_point_around_another(a3, center, -2/3*math.pi)
  21. self.msp.add_line(a4, a5, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  22. self.msp.add_line(a5, a6, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  23. a7 = core.rotate_point_around_another(a1, center, 2/3*math.pi)
  24. a8 = core.rotate_point_around_another(a2, center, 2/3*math.pi)
  25. a9 = core.rotate_point_around_another(a3, center, 2/3*math.pi)
  26. self.msp.add_line(a7, a8, dxfattribs={"layer": f"图层{self.obj.layer_id}"})
  27. self.msp.add_line(a8, a9, dxfattribs={"layer": f"图层{self.obj.layer_id}"})