import math from ezdxf import math as mt from core import rotate_point_around_another class FanSystemDrawer: def __init__(self, msp, gap, center, route): self.msp = msp self.gap = gap self.center = center self.route = route def draw_fan_system(self): rad = self.gap / 2 carc = mt.arc.ConstructionArc() # 初始化扇形起始和结束点 fan_a_start = (self.center[0], self.center[1] + rad) fan_b_start = (self.center[0] - rad / 2, self.center[1] + rad / 2) # 绘制中心圆 self.msp.add_circle(self.center, rad) # 绘制每个扇形 for i in range(3): fan_a = rotate_point_around_another(fan_a_start, self.center, self.route + i * (2 / 3) * math.pi) fan_b = rotate_point_around_another(fan_b_start, self.center, self.route + i * (2 / 3) * math.pi) fan_carc_3p = carc.from_3p(start_point=fan_a, def_point=fan_b, end_point=self.center) self.msp.add_arc(center=fan_carc_3p.center, radius=fan_carc_3p.radius, start_angle=fan_carc_3p.start_angle, end_angle=fan_carc_3p.end_angle) # 绘制中心到扇形起点的线段 self.msp.add_line(fan_a, self.center)