Grasshopper

algorithmic modeling for Rhino

Hi hi,

I'm trying to connect Grasshopper with some software over its API. It includes following programming languages: (look at attachment)

First I started with Python, but because some compatibility problem (with ctypes) of IronPython I gave up for now. Now I'm cheking next possible language... but Grasshopper has VB.NET and C#.NET...but API has them without .NET. Will I be able to connect them? some suggestion for start? Example...tutorial...?

Regards,

Damir

Views: 2673

Attachments:

Replies to This Discussion

C# is always .NET, it was invented at roughly the same time. Visual Basic existed before .NET came along, which is why it's called VB.NET. Older versions of VB are VB6, VB5, etc.

It's highly unlikely anyone is still using VB5 or VB6, so I'm guessing the VB you're looking at is the VB you need. Or, if you prefer C#, there's no problem at all.

To start developing GHA plugins, you must install Visual Studio (Express, or Professional, or SuperHot or whatever the different versions are called, they should all work). Then you install the GHA project wizards, they'll help you set up a project.

You can download the GH SDK documentation (via the GH help menu), it has code examples on how to make components, parameters, etc.

David,

tnx for your explanation and advice.

Hellooo,

I have some further question(s)... I went through API example code... I understand how it works...

I imagined that I would just somehow copy code inside VB Script Component and it will somehow work...

My example VB Project has Main code vb file and two vb Modules. Functions in main code are then calling API functions from those Modules. Look at attached pdf file.

Can I do it on imagined way? How to import, include Models (they are quite big files, with many functions defined)? Or it is easier to make new component in Visual studio. I think it would be more practical if I can quickly change code inside Grasshopper instead of changing it in Visual Studion, then save it, then import again,...

Any suggestion how to preceed, example, advice will be highly appreciated.

Regards,

Damir

Attachments:

It depends a bit on the code how portable it is between GH_Component classes in Visual Studio and the Script components. But the code is never exactly the same, the script components have a lot less functionality, and they expose UI for setting up things like type hints and list access etc. 

You can absolute copy/paste code that is not Grasshopper specific and it should work the same (provided you have all required references set up correctly). You can either put these modules in a separate file, or paste them in the same file, next to the GH_Component derived classes.

Do note that modules are almost never a good idea, it's better practice to use static classes (or, in VB, NotInheritable classes with private constructors and static methods).

I'm a bit confused about your project, as there seems to be a lot going on (there's a winforms UI, you're importing unmanaged methods from a DLL somewhere).  I don't understand what (if anything) your component is supposed to do. Is the functionality embedded in a window? Is it supposed to run as part of or outside of the Grasshopper solutions?

Can you upload a compilable VS project with some boiler plate code that shows what it is you're after and where the problems lie?

Hi David, Hi All,

ok, probably I didnt explain it... I attached also short summary of API (where it is explained how it works). So...Strand7 is FEA program where you can build your model (nodes, beams, plates,...load it) and then get analysis result. API make possible to do everythink out of Software...

The example code Im trying to put in function now makes folowing: it opens some file, get model nodes coordinates, change them, do some calculatons, give me back stresses for each element and then save and close a file. In case of VB is everything controled from simple windows UI. For now I would like to define (for example) new coordinates and other needed paramethers in Grasshopper....to replace windows GUI....and then control hole task from Grasshopper.

I attached also project code files...and picture of GUI.

David, I hope after reading me you don't look like on your profile photo :)

Kind regards,

Damir

Attachments:
Rar files don't work on ning I'm afraid, you'll have to use zip.

Here is .zip one

Attachments:

Hi David,

I decided to do new component. I did smal progress...I have now another problem... I pointed it out in new discussion:

http://www.grasshopper3d.com/forum/topics/problem-with-for-loop-at-...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service