From eed41fffdddda017360d2b0dfb2e92780ffe66c4 Mon Sep 17 00:00:00 2001 From: Ehsan Iran-Nejad Date: Tue, 14 Jun 2022 17:24:57 -0700 Subject: [PATCH] fixed __rhinodoc__ access --- python3/scriptcontext.py | 4 ++-- tools/convert_py2to3.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python3/scriptcontext.py b/python3/scriptcontext.py index ba05521..1113256 100644 --- a/python3/scriptcontext.py +++ b/python3/scriptcontext.py @@ -1,10 +1,10 @@ # scriptcontext module -# import RhinoPython.Host as __host +import Rhino '''The Active Rhino document (Rhino.RhinoDoc in RhinoCommon) while a script is executing. This variable is set by Rhino before the exection of every script. ''' -doc = __rhinodoc__ +doc = Rhino.RhinoDoc.ActiveDoc '''Identifies how the script is currently executing diff --git a/tools/convert_py2to3.py b/tools/convert_py2to3.py index 99af24a..c72e0cc 100644 --- a/tools/convert_py2to3.py +++ b/tools/convert_py2to3.py @@ -92,9 +92,9 @@ def scriptcontext_fixes(item): """Fix misc items in scriptcontext.py""" with SourceFile(item) as sf: sf.replace( - "import RhinoPython.Host as __host", "# import RhinoPython.Host as __host" + "import RhinoPython.Host as __host", "import Rhino" ) - sf.replace("doc = None", "doc = __rhinodoc__") + sf.replace("doc = None", "doc = Rhino.RhinoDoc.ActiveDoc") sf.replace( "rc = __host.EscapePressed(reset)", "rc = None # __host.EscapePressed(reset)",