Quantcast
Channel: Dotnet/C# – Xinyustudio
Viewing all articles
Browse latest Browse all 204

Rhino C# Development (II) : HelloRhino

$
0
0

If you have not got Rhino Visual Studio working, see this post to get it done.

1. In Visual Studio, create a new project, in the opened dialog, type “rhino” in the upper right filter field:

image

2. Click Ok in the dialog, and a boiler plate Rhino addin project is created for you.

image

Click Finish button. Visual Studio opens the project and you can add your code then.

image image

In the Solution Explorer, you can find two C# classes are created for you, and the necessary reference “RhinoCommon” is also added to you. Lovely, Smile

Note that in development for Rhino 4, you generally need a minimum of 3 classes to get a Rhino run, which includes (plugin, command and plugin attribute), the latest RhinoCommon based Rhino development, simplified this and makes more senses and neat.

3. Let’s say hello to Rhino!

Open hello.cs, and browse to RunCommand() function, added below sentence, compile and run!

image

4. Now Rhino 5 starts. But you may find no changes, and Rhino just runs without appreciating your effort, where is your plugin?

Well, be patient. You have shaked hands with Rhino, but keep talking with her:

  • Go to menu Tools > Options
  • In the left tree view, click “Plug in”, and then in the right panel, click “Install” button
  • Browser your addin dll which is in the bin\debug folder under your project root folder now, and click “open” button to load your dll into Rhino

image image

image image

Now in the command window, type “Hello” and press enter:

image 

image

Oh, yeah! You have said hello to Rhino now!

arrow, download icon

Download Visual Studio 2010 Source project: HelloRhino.7z; or HelloRhino.zip.


Viewing all articles
Browse latest Browse all 204

Trending Articles