Grasshopper

algorithmic modeling for Rhino

GH Matrix to Numpy Matrices and backwards, how can I convert them?

Hey together!

I started to work with numpy for python and It works quit good. My problem is, that I only can use matrices I defined in the python script. When I use the Python component in GH Numpy dosn´t identify the matrices at the input. how can I convert the GH matrices to Numpy matrices? Do I have to rebuildt them? The same when I want a GH matrix at the output. I can print the Numpy matrices but as variable, so that GH can further use them I don´t know how to do it.

Views: 1555

Replies to This Discussion

Hi Apfelbaum

yes, you need to create them from scratch. Grasshopper has no knowledge of numpy, and vice versa.

May I ask you which installation instructions you followed for numpy?
Thanks,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

I followed the two instructions I attached and run all cmd as administrator. The first is from the enthougt webside and the second from a discussion in this forum. Worked well for me.

https://store.enthought.com/repo/.iron/

1.) IronPython

Download and install IronPython 2.7, this will require .NET v4.0.

2.) Modify PATH

Add the install location on the path, this is usually: C:\Program File\IronPython 2.7

But on 64-bit Windows systems it is: C:\Program File (x86)\IronPython 2.7

As a check, open a Windows command prompt and go to a directory (which is not the above) and type:

> ipy -V PythonContext 2.7.0.40 on .NET 4.0.30319.225 

3.) ironpkg

Bootstrap ironpkg, which is a package install manager for binary (egg based) Python packages. Download ironpkg-1.0.0.py and type:

> ipy ironpkg-1.0.0.py --install 

Now the ironpkg command should be available:

> ironpkg -h (some useful help text is displayed here) 

4.) scipy

Installing scipy is now easy:

> ironpkg scipy numpy-2.0.0-1.egg       

http://www.grasshopper3d.com/forum/topics/scipy-and-numpy

The issue is that ironpkg cannot access the eggs because this also requires authentication. The reason you were able to install ironpkg (you'll see an egg file was created) is due to that fact that the egg data was in the install file ironpkg-1.0.0.py (see b64eggdata in the file).

1. The installation eggs are located here: https://store.enthought.com/repo/.iron/eggs/ 

2. Download the eggs and change to your local directory where you download them

3. Run this script in the same directory:

         https://gist.github.com/blondegeek/2dbc22360422d0c4b637

   as:

         ipy IronPython_numpy_scipy.py --install

4. Test with:

         ipy -X:Frames -c "import scipy"



for the ipy commands you have to change the direction to the downloadfolder with CD command! Just if someone want to use this explanation.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service