123456789101112131415161718192021222324252627282930313233343536373839404142 |
- from drawer.BaseDrawer import VentGraphDrawer, BaseDrawer
- from entity.Node import Node
- from entity.primitives import Empty, Face
- class FaceDrawer(BaseDrawer):
- def __init__(self, obj, msp, style):
- self.face_drawers = {
- 0: self.draw_face_style_0,
- }
- super().__init__(obj, msp, style)
- def initialize_data(self):
- pass
- def draw_agg(self):
- self.face_drawers[self.style]('agg')
- def draw_div(self):
- self.face_drawers[self.style]('div')
- def draw_face_style_0(self,type):
- assert isinstance(self.obj, Face)
- point_attr = 'agg_point' if type == 'agg' else 'div_point'
- boundary_points = []
- for node in self.obj.node_list:
- node = getattr(node, point_attr)
- boundary_points.append(node)
- hatch = self.msp.add_hatch(color=1)
- hatch.set_pattern_fill(name='JIS_WOOD', scale=20, angle=75)
- # 新版本直接添加多段线路径,无需 flags 参数
- hatch.paths.add_polyline_path(
- boundary_points,
- is_closed=True # 只需确保闭合即可
- )
|