Skip to content

Commit bbcc973

Browse files
committed
ironpyton relatived search path
1 parent 7376914 commit bbcc973

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

IronPythonConsole.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
#coding=utf-8
2+
23
import clr
3-
import sys
4-
RhinoSystem = "C:\\Program Files\\Rhino 6\\System\\"
5-
RhinoPlugin = "C:\\Program Files\\Rhino 6\\Plug-ins\\"
6-
clr.AddReferenceToFileAndPath(RhinoSystem + "RhinoCommon.dll")
4+
clr.AddReference("RhinoCommon")
75
clr.AddReference("Eto")
86
clr.AddReference("Eto.Wpf")
97
clr.AddReference("System.Windows.Forms")
108
clr.AddReference("System.Drawing")
11-
sys.path.append("C:\\Program Files\\Rhino 6\\Plug-ins\\IronPython\\Lib\\")
12-
sys.path.append("C:\\Users\\mahai\\AppData\\Roaming\\McNeel\\Rhinoceros\\6.0\\Plug-ins\\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib\\")
139

10+
# init sys.path
1411
import Rhino
15-
import scriptcontext
16-
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
12+
import sys
13+
sys.path.append(Rhino.ApplicationSettings.FileSettings.InstallFolder.FullName + "Plug-ins\\IronPython\\Lib\\")
14+
sys.path.append(Rhino.ApplicationSettings.FileSettings.GetDataFolder(True) +
15+
"Plug-ins\\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib\\")
1716

18-
# todo 这部分为了与官方的RhinoPython.Host兼容
17+
### init scriptcontext
18+
# the offical Rhino.Python.Host module can not working in this environment.
19+
# reimplement Rhino.Python.Host.Coerce3dPointFromEnumerables function.
1920
import RhinoPython.Host
2021

22+
# the offical scriptcontext.doc can not working in this environment.
23+
# assignment Rhino.RhinoDoc.ActiveDoc to scriptcontext.doc
24+
import scriptcontext
25+
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
2126

RhinoPython/Host/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import Rhino
2+
3+
### init scriptcontext
4+
# the offical Rhino.Python.Host module can not working in this environment.
5+
# reimplement Rhino.Python.Host.Coerce3dPointFromEnumerables function.
6+
import RhinoPython.Host
27
def Coerce3dPointFromEnumerables(point):
38
return Rhino.Geometry.Point3d(point[0],point[1],point[2])

0 commit comments

Comments
 (0)