Skip to content

Commit

Permalink
ironpyton relatived search path
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaidong committed Aug 20, 2020
1 parent 7376914 commit bbcc973
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
23 changes: 14 additions & 9 deletions IronPythonConsole.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#coding=utf-8

import clr
import sys
RhinoSystem = "C:\\Program Files\\Rhino 6\\System\\"
RhinoPlugin = "C:\\Program Files\\Rhino 6\\Plug-ins\\"
clr.AddReferenceToFileAndPath(RhinoSystem + "RhinoCommon.dll")
clr.AddReference("RhinoCommon")
clr.AddReference("Eto")
clr.AddReference("Eto.Wpf")
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
sys.path.append("C:\\Program Files\\Rhino 6\\Plug-ins\\IronPython\\Lib\\")
sys.path.append("C:\\Users\\mahai\\AppData\\Roaming\\McNeel\\Rhinoceros\\6.0\\Plug-ins\\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib\\")

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

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

# the offical scriptcontext.doc can not working in this environment.
# assignment Rhino.RhinoDoc.ActiveDoc to scriptcontext.doc
import scriptcontext
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc

5 changes: 5 additions & 0 deletions RhinoPython/Host/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import Rhino

### init scriptcontext
# the offical Rhino.Python.Host module can not working in this environment.
# reimplement Rhino.Python.Host.Coerce3dPointFromEnumerables function.
import RhinoPython.Host
def Coerce3dPointFromEnumerables(point):
return Rhino.Geometry.Point3d(point[0],point[1],point[2])

0 comments on commit bbcc973

Please sign in to comment.