Grasshopper

algorithmic modeling for Rhino

I got an error when I was trying to import a py modulus and a dll file in the same folder. I grab this "matrix" modulus from internet, which utilizes "xalglib" and "alglibnet2.dll". I place them all under the same folder: "C:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib". The ghpython component can access the module when calling "import matrix" but it cannot access the subsequent "xalglib" module; I've also tried "import xalglib", but now cannot access "alglibnet2.dll". Is it possible to grant permission to access the files in the same folder?

Views: 1365

Attachments:

Replies to This Discussion

Hi David

I asked Will if he knew what was going on, as he wrote the matrix code.
It will for sure require him less time than it would to me.

Let's see what he can say.

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

Thanks Giulio for quoting the source. I will wait for Will's reply then.

David,

Thanks for your patience. First there are a couple of things you should be aware of before using this very limited matrix module:

1. Please see Giulio's recent post on using Math.NET Numerics from GhPython for a fully featured matrix library.

2. ALGLIB is only required for the `Matrix.eig()` function.

I wrote this module specifically to be called by meshCurvatureTensors.py (which itself is purely a proof-of-concept port of an algorithm I'd previously implemented in Java). To test that everything's still working as expected I dropped matrix.py and meshCurvatureTensors.py into the same folder as xalglib.py and alglibnet2.dll and called meshCurvatureTensors.py via _RunPythonScript (Mac and Windows).

As for GhPython, I just tried adding the directory containing matrix.py, xalglib.py, etc., to the module search path (_EditPythonScript > Tools > Options) and it seemed to work.

Thanks Will. I still have problems with that even though I put all three files under the same folder and I'm sure they are unblocked. It seems that the ghPython do not have permission to access the folder.

Hmm, I was just able to reproduce the error you're seeing by putting matrix.py, xalglib.py and alglibnet2.dll in C:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\. After further investigation it seems I can only load the xalglib module in python after first loading it in Rhino (i.e. by running the meshCurvatureTensors.py script). Please try this workaround (or try using Math.NET Numerics) while we look into the problem.

Thanks. I will try loading the xalglib module in Rhino python script first. Also I will give Math.Net Numerics a try.

That will likely not suffice. It seems it is just a problem with the relative location of the file. See below. Thanks.

Hi Will, Hi David, 

I have been trying to work with ALGLIB those days and I got the exactly the same error than David in GhPython.

Also, loading the script in Rhino first seems not working for me.

Thanks for your help !

Hi Florian, can you see if the method defined below will work? Thanks.

I will try that today and give you feedback, thanks Giulio !

Hi all,

a description of the bug in xalglib and a possible method to solve it are explained here:

https://mcneel.myjetbrains.com/youtrack/issue/GH-1838

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

Hi Giulio, 

Here is the message i get after modifying xalglib and matrix as decribed above :

Thanks for your help!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service