algorithmic modeling for Rhino
Can someone recommend me a viable way of installing numpy to be used in grasshopper. I know about this tutorial http://stevebaer.wordpress.com/2011/06/27/numpy-and-scipy-in-rhinop...
but the link there is not working anymore.
Thanks!
Tags:
Link still works for me...
here's the content anyway:
Yes it is possible now!!!
Okay, here’s what I did to get numpy/scipy running in Rhino
1 – Install Rhino 5 (32bit version)
numpy/scipy uses C++ DLLs which need to be compiled for a specific platform. Currently numpy/scipy for IronPython will only run in 32bit applications on Windows. I contacted the guys at Enthought and they do plan on releasing a 64bit version for Windows, but they want to make sure everything is working on 32bit first. They have some doubts about being able to release a mono version for you Mac guys out there.
2 – Install numpy/scipy for IronPython
Follow the instructions on this site http://www.enthought.com/repo/.iron/
3 – Modify settings in RhinoPython
Start Rhino 5 – 32bit version and run “EditPythonScript” to bring up the editor. Go to the options dialog by selecting Tools->Options from the menu
Add site-packages and DLLs to the search paths (see image). This helps RhinoPython find the numpy/scipy packages and associated DLLs.
Check the “Frames Enabled” option since numpy/scipy requires this to be turned on.
I decided to make the “Frames Enabled” an optional engine feature since it does have a performance impact on scripts. Numpy/scipy requires this feature to be turned on.
4 – Run a test
# For now, we need to manually load mtrand before using numpy or scipy
# I'm still trying to figure out why mtrand is not automatically getting
# loaded when numpy/scipy imports it. If I can fix this, we won't need
# the following two lines
import clr
clr.AddReference("mtrand")
import numpy
import rhinoscriptsyntax as rs
x_coord = [ 0, 1, 2, 3, 4, 5, 6]
y_coord = [0.0,0.1,0.5,2.5,2.5,2.5,4.0]
xyz = zip(x_coord,y_coord,[0]*len(x_coord))
rs.AddPoints(xyz)
degree = 5
eq = numpy.polyfit(x_coord, y_coord, degree)
fitfunc = numpy.poly1d(eq)
fit_points = []
for i in range(61):
x = i/10.0
y = fitfunc(x)
fit_points.append((x, y, 0))
rs.AddPolyline(fit_points)
If you get a polyline in rhino fit through a series of points then you are all all set; if not go back to step 1 and repeat.
This looks like a good place to start if you want to learn more about numpy/scipy
Sorry maybe I didn't make myself clear this link does not work for me https://store.enthought.com/repo/.iron/
Ah - try the links on this page: http://blog.enthought.com/python/scipy-for-net/
yes numpy-refactor poped up while reading about ironpython numpy but it needs compiling, right? How do you start the setup.py from rhino's ironpython. I checked my folder there isn't ironpython.exe, just the dlls.
If I set it up with separate full installation of ironpython and move the files after that, would it work?
These instructions are not really clear I cant seem to find iron python in my programs are there other instructions anywhere?
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by