Salome HOME
Implement Collinear constraint
[modules/shaper.git] / src / PythonAPI / model / sketcher / tools.py
index 31efc0f2837f28290a468aea7c0d2e3643b833ae..3603f20061b35215c312877b8a5b94ec66671af3 100644 (file)
@@ -1,6 +1,7 @@
 # Author: Sergey Pokhodenko
 # Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
+import ModelHighAPI
 
 def addPolyline(sketch, *coords):
     """Add a poly-line to sketch.
@@ -44,4 +45,7 @@ def addPolygon(sketch, *coords):
 def dof(sketch):
     """ Extract degrees of freedom for the given sketch
     """
-    return int(filter(str.isdigit, sketch.string("SolverDOF").value()))
\ No newline at end of file
+    aSketch = sketch
+    if issubclass(type(aSketch), ModelHighAPI.ModelHighAPI_Interface):
+        aSketch = sketch.feature()
+    return int(filter(str.isdigit, aSketch.string("SolverDOF").value()))
\ No newline at end of file