Grasshopper

algorithmic modeling for Rhino

Hi all,

I have been working on a project which involves creating 3D models in Rhino and Grasshopper and then using the model to run some simulations under seismic loads. I have been able to create a visual post-processor in processing to visualize the movement of the model but I have been thinking that it might be useful to have a way to bring back the results of my simulation back into Rhino so that I can see how the model behaves as well as create more appealing graphical renderings for presentations, etc..

All of this introduction aside, in order to visualize the movement the model, I need to have access to some matrix manipulation and numerical tools which are not (to the best of my knowledge) available in the .Net framework or Rhino SDK. In particular I need to have access to a function to perform singular value decomposition (svd).  I have found a number of free libraries available that offer this function. However, since I have no previous experience in programming in .Net, I am not sure how I can make use of the libraries. It seems like I have to compile the libraries as assemblies and add them to the custom scripting component. Is there a tutorial that I can look at to get some insight on what is involved? Is there something that is available as a binary that I can just throw in and use without needing to do any of these stuff?

Any help is greatly appreciated.

Thanks,

Ali

Views: 1978

Replies to This Discussion

you can perhaps use Rhino 5 and Python for Rhino or Python for Grasshopper and import needed dll to python.

Python is one of glue programming language, which can good import already existing dlls.

I will try and look into this. However, given that I am not really that experienced with programming and have already written most of what I need to do in both java and c#, I would prefer to stay away from yet another language until I have more experience. But thanks for your suggestion.

Well I've found ALGLIB, and tried to load the alglibnet2.dll which came with the csharp package into the a c# component in grasshopper but it seems that there is a problem:

//No namespaces could be found for 'C:\Users\Ali\Downloads\alglib-3.6.0.csharp\csharp\alglibnet2.dll'

Any ideas?

I also tried, with c# component to import assembly, but same error message.

after that, I used python in Rhino 5 and it works.

Python has very similar grammar with C#

you can maybe simply with python start.

If you will...

1. download alglib for Ironpython

2. copy alglibnet2.dll and xalglib.py to \Rhino 5\Plug-ins\IronPython\Lib

3. start Rhino 5

4. run EditPythonScript

5. just write code in blank py document...

import xalglib

6. save py document and run this code.

7. open Grasshopper and now you can use alglib in Grasshopper with python component.

(without step 6, GH Python will return error message, that could not find alglibnet2.dll.)

This is very good! Thanks for the information. The only challenge is that I don't have access to Rhino 5 yet. I'll have to see if I can push the graduate school/my department to buy the updates!

Hi all,

Sorry to revive this old thread. However, I've finally got a Rhino 5 license (after some begging to the administration). I've installed Rhino 5 x64. I was thinking that this would set me up to finally be able to do what I wanted to do before. However, it seems that the the python component doesn't really work on 64 bit version of Rhino 5 (or at least this is what I understood). I wanted to use the IronPython distribution of the ALGLIB as outlined by y.KWON. But I also looked into it and it seems like I can also use NumPy to accomplish some of the numerical tasks outlined before. However I'm not really sure what packages I need to install to accomplish this. I'm not sure if I need to install the 32-bit version of Rhino along-side 64-bit to accomplish this or I have to just choose 32-bit if I want to get this done.

I'm still hoping there is a way for me to just use one of the existing libraries for C# (like ALGLIB) and somehow load them into the C# component and be done with it. Is there a chance that this can be done? Is there a platform issue associated with C# libraries as well (i.e. 32 vs. 64).

I'm sorry if my questions are stupid but I'm not really well-versed in programming in any language.

Regards,

Ali

Hi Ali,

I've tried aglib in a python component as well, but to no avail.
I've managed to make a custom component which takes the SVD of a matrix using C#. 

The library used is the 64bit version of ILNumerics (they claim it is one of the fastest) and it works with Rhino 5 64bit. Currently I'm fine tuning the component for my project in Visual Studio (referencing the lib in a script component doesn't work).

It's my first C# project ever and I'm a very novice programmer, but I'm willing to share some of my work to get you started. Try ILNumerics for your self or let me know how I can help.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service