from tqdm import tqdm from drawer.BaseDrawer import BaseDrawer from entity.primitives import Tun3d class Tun3dDrawer(BaseDrawer): def initialize_data(self): pass def draw_agg(self): assert isinstance(self.obj,Tun3d) self.draw_plg(self.obj.plg_b.plg_agg,(0,0,0)) self.draw_plg(self.obj.plg_l.plg_agg,self.obj.color) self.draw_plg(self.obj.plg_r.plg_agg,self.obj.color) def draw_div(self): pass def draw_plg(self,points,color): hatch = self.msp.add_hatch(dxfattribs={"layer":f"图层{self.obj.layer_id}"}) hatch.rgb = color edge_path = hatch.paths.add_edge_path() for i in range(3): edge_path.add_line(points[i], points[i+1]) edge_path.add_line(points[-1], points[0])