123456789101112131415161718192021222324252627282930 |
- from drawer.BaseDrawer import BaseDrawer
- from entity.primitives import Tun3d, TunGap
- class TunGapDrawer(BaseDrawer):
- def initialize_data(self):
- self.obj.layer_id = 1
- def draw_agg(self):
- assert isinstance(self.obj,TunGap)
- self.draw_gap(self.obj.plg.plg_agg)
- def draw_div(self):
- pass
- def draw_gap(self,point_list):
- hatch = self.msp.add_hatch(dxfattribs={"layer": f"图层{self.obj.layer_id}"})
- hatch.rgb = (0, 0, 0)
- edge_path = hatch.paths.add_edge_path()
- for i in range(len(point_list)):
- if i+1<len(point_list): edge_path.add_line(point_list[i], point_list[i + 1])
- edge_path.add_line(point_list[-1], point_list[0])
|