Salome HOME
Rewrite local function ModifySurface of BlockFix_SphereSpaceModifier
[modules/geom.git] / src / GEOM_PY / sketcher.py
index aeba6b43b5fe79927e968d5fb346248f8a9b759a..2f388f56808178d2a558e072db99adc11e1e46e1 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: iso-8859-1 -*-
 #
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
+## \defgroup simplesketcher sketcher - Simplified sketcher API
+#  \{
+#  \details
+#  This module provides simplified access to the 2D sketcher functionality of Geometry module.
+#  
+#  \note This module is deprecated, refer to \ref gsketcher for more details
+#  \}
+
 """
 This module provides the user with a simple python API to realize
 various sketches from the GEOM text user interface.
@@ -38,19 +47,30 @@ Example::
     wire = mysketcher.getGeomWire()
 
     # Put it in the study
-    import geompy
+    from salome.geom import geomBuilder
+    geompy = geomBuilder.New()
     geompy.addToStudy( wire, 'mysketch' )
 
-Additionnal examples can be found as unit tests in the source code.
+Additional examples can be found as unit tests in the source code.
 """
 
 geompyEnable = True
 try:
-    import geompy
+    from salome.kernel.deprecation import is_called_by_sphinx
+    if not is_called_by_sphinx():
+        import salome
+        salome.salome_init()
+        import GEOM
+        from salome.geom import geomBuilder
+        geompy = geomBuilder.New()
+        pass
+    pass
 except:
     geompyEnable = False
-    
+    pass
 
+##
+#  \ingroup simplesketcher
 class Sketcher:
 
     __sketch = None
@@ -117,11 +137,11 @@ def TEST_toString():
 
     expectedResult = "Sketcher:F 1.234 4.321:TT 2.234 5.321"
     result = mysketcher.toString()
-    print "sketcher=",mysketcher.toString()
+    print("sketcher=",mysketcher.toString())
     if result == expectedResult:
-        print "OK"
+        print("OK")
     else:
-        print "Not OK"
+        print("Not OK")
 
 def TEST_usingGeom():
     mysketcher = Sketcher()