1 # Author: Sergey Pokhodenko
2 # Copyright (C) 2014-20xx CEA/DEN, EDF R&D
5 def addPolyline(sketch, *coords):
6 """Add a poly-line to sketch.
8 The end of consecutive segments are defined as coincident.
13 line_1 = sketch.addLine(c0, c1)
14 polyline.append(line_1)
15 # Adding and connecting next lines
17 line_2 = sketch.addLine(c1, c2)
18 sketch.setCoincident(line_1.endPoint(), line_2.startPoint())
19 polyline.append(line_2)
25 def addPolygon(sketch, *coords):
26 """Add a polygon to sketch.
28 The end of consecutive segments are defined as coincident.
30 pg = addPolyline(sketch, *coords)
31 # Closing the poly-line supposed being defined by at least 3 points
33 cn = coords[len(coords) - 1]
34 ln = sketch.addLine(cn, c0)
36 pg[len(coords) - 2].endPoint(), ln.startPoint()
39 ln.endPoint(), pg[0].startPoint()