NodeGapDrawer.py 568 B

1234567891011121314151617
  1. class NodeGapDrawer:
  2. def __init__(self,msp,point_list,layer_id):
  3. self.msp = msp
  4. self.point_list =point_list
  5. self.layer_id = layer_id
  6. def draw_gap(self):
  7. hatch = self.msp.add_hatch(dxfattribs={"layer": f"图层{self.layer_id}"})
  8. hatch.rgb = (0, 0, 0)
  9. edge_path = hatch.paths.add_edge_path()
  10. for i in range(len(self.point_list)):
  11. if i+1<len(self.point_list): edge_path.add_line(self.point_list[i], self.point_list[i + 1])
  12. edge_path.add_line(self.point_list[-1], self.point_list[0])