1 # Author: Sergey Pokhodenko
2 # Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 def addPolyline(sketch, *coords):
7 """Add a poly-line to sketch.
9 The end of consecutive segments are defined as coincident.
14 line_1 = sketch.addLine(c0, c1)
15 polyline.append(line_1)
16 # Adding and connecting next lines
18 line_2 = sketch.addLine(c1, c2)
19 sketch.setCoincident(line_1.endPoint(), line_2.startPoint())
20 polyline.append(line_2)
26 def addPolygon(sketch, *coords):
27 """Add a polygon to sketch.
29 The end of consecutive segments are defined as coincident.
31 pg = addPolyline(sketch, *coords)
32 # Closing the poly-line supposed being defined by at least 3 points
34 cn = coords[len(coords) - 1]
35 ln = sketch.addLine(cn, c0)
37 pg[len(coords) - 2].endPoint(), ln.startPoint()
40 ln.endPoint(), pg[0].startPoint()
46 """ Extract degrees of freedom for the given sketch
49 if issubclass(type(aSketch), ModelHighAPI.ModelHighAPI_Interface):
50 aSketch = sketch.feature()
51 return int(filter(str.isdigit, aSketch.string("SolverDOF").value()))