1234567891011121314151617181920212223242526272829303132333435363738 |
- import math
- import core
- class FanMainDrawer:
- def __init__(self, msp, layer, gap, center, route):
- self.layer = layer
- self.msp = msp
- self.gap = gap
- self.center = center
- self.route = route
- def draw_fan_main(self):
- rad = 0.5 * self.gap
- a = math.pi / 8
- b = 10 / 3 * rad
- self.msp.add_circle(center=self.center, radius=rad, dxfattribs={"layer": f"图层{self.layer}"})
- A = (rad * math.cos(a) + self.center[0], rad * math.sin(a) + self.center[1])
- C = (rad * math.cos(a) + self.center[0], -rad * math.sin(a) + self.center[1])
- B = ((b / 2) / math.tan(a) + self.center[0], (b / 2) + self.center[1])
- D = ((b / 2) / math.tan(a) + self.center[0], -(b / 2) + self.center[1])
- A = core.rotate_point_around_another(A, self.center, self.route)
- B = core.rotate_point_around_another(B, self.center, self.route)
- C = core.rotate_point_around_another(C, self.center, self.route)
- D = core.rotate_point_around_another(D, self.center, self.route)
- self.msp.add_line(A, B, dxfattribs={"layer": f"图层{self.layer}"})
- self.msp.add_line(B, D, dxfattribs={"layer": f"图层{self.layer}"})
- self.msp.add_line(C, D, dxfattribs={"layer": f"图层{self.layer}"})
|