What is the difference btw. Rhino Developer Tools?


#1

Hello guys,

I would like to get some help for Rhino Dev. Tools. I am a beginner, with no experience in programming, however getting interested.

I can choose btw. the followings:

RhinoScript - So a range of repeating commands with options and small panel interface
Rhino.Python - another script language
RhinoCommon (VB.NET/C#/Python) - Powerful developer tool
C++ Plug-ins - Also a powerful developer tool

According to my current knowledge C++ is the best but most complicated language which learning term is more then in case of VB, .NET, Python. But I know nothing about them.

My question is what the limitation and the main purpose of .VB, .NET, Python is. And how easier to start learning programming in the context of Rhino? And what is the development process of a plugin? I would like to deal with databases.

As I have checked already VB is more friendly with graphical interface using Visual Basic Express for light applications however I do not know how VB can connect with Rhino.

So I am a little bit confused in this topic and I would be happy if someone could write some line to explain.

Cheers,


#2

Rhinoscript is indeed a scripting language, based on Microsoft’s VbScript and enhanced to provide a lot of functions which give access to Rhino commands on a programming level. It’s advantage over simple Macro programming is that it allows use of control structures like “if-then-else” and looping.

All the others you mentioned are regular general purpose programming languages. They can produce .exe files to use as standalone programs, but they can also produce .dll files, which are libraries of executable code that need to be called by an executable program to perform some specific action. In the case of Rhino they are used to create “plugins”, which is just Rhino’s name for Rhino-specific .dll’s. In order to write plugins that do things in Rhino, libraries of lower-level routines that perform Rhino tasks are made available by McNeel to use in your plugin code. They are referred to as "SDK"s, short for System Development Kit. There are two basic kinds of kits: the C++ kit, which provides native-code functions for C++ programmers, and “managed”-code kits, which provide Rhino functions written in Microsoft’s .NET API (Application Programming Interface). The earlier of these is the Rhino .NET SDK, while the emerging replacement is the RhinoCommon SDK. The managed-code libraries may be used by C++ programmers, but VB, C# and Python are designed to use them and it’s much more complicated to use a native-code library with them.

As far as which language to choose from VB, C# or Python: if you have little to no previous experience they are all about equal in ease of learning. Python is expected to offer the potential of creating Rhino plugins that will work in both Windows and Mac Rhino, although there is no plugin capability available in Mac Rhino just yet.

The overall capabilities of VB, C# and Python are pretty much the same, as they are all based on the same set of modern programming ideas. Their differences are in syntax and minor variations in programming concept implementation. VB and C# are both Microsoft languages based on the same underlying compiler engine and the only reason they both exist is that they each provide easy-to-learn paths to managed programming for their respective target user: VB.NET for the experienced Visual Basic user and C# for the experienced C++ user. Python is an independently developed open-source language whose syntax and structure is a little more unique (some would say more modern) than the other two. Python can also use the Microsoft .NET libraries. Both the .NET libraries and the Python libraries have powerful database functionality available.

Much of the programming power of these languages comes from the programming environment of Visual Studio. Look into “intellisense”. You also appear to be aware of the control libraries available for easily creating the user interface for your plugin. These save a lot of time, and I believe are available via Visual Studio for C# as well as VB.NET. I’m not sure about C++ and Python. For debugging, Visual Studio has a provision to to tell it what program it should start up to use your .dll for debugging it. This would be Rhino for a Rhino plugin, of course. So when you click “Start debugging”, Visual Studio will automatically start the copy of Rhino which you specified so you can execute your plugin commands in it.

I hope this has provided a useful overview for you and answered your main questions.


(Steve Baer) #3

I would recommend starting with python. You can get an awful lot done with that language in Rhino and it is relatively easy to learn. Start by downloading and reading a little of the Rhino.Python 101 manual which can be found here


(Brian Gillespie) #4

I agree with Steve. Of all the languages Rhino supports, python has the simplest and most readable syntax. You’ll be able to do everything you could do in a C# plug-in with python, and perhaps more than you could do in RhinoScript. C++ is by far the hardest to learn and write well. There are advantages to C++, but those advantages are getting fewer and fewer as time progresses.


#5

The developer/python page has lots of good examples, some quite recent, but is short on programming environment info.
The Rhino.Python 101 manual is dated 2011.
This site is from 2010:
http://python.rhino3d.com/content/117-RhinoPython-Resources-Section

I know that much has taken place since then and that now that Rhino 5 is released things re: RhinoCommon and Python aren’t changing as fast.

Can you take some time here to summarize:
The available programming environments for Python Rhino scripts/plugins and their relative advantages/disadvantages (including debugging process)?
The current status of Rhinocommon as to how much of the intended functionality is implemented and how much of the implementation is reasonably tested and bug-free?
Tools available in Python for interactively designing user interfaces (in comparison to VB.NET for example)?
Whether there is a difference between what you are calling Python Scripting and Rhino plugin .dll’s written with Python?
The current status of Python scripting for Mac and how it differs (if at all) from Windows Python scripting?
The current status of Rhino Mac user plugins and the near-term timeline for incorporation?

I know that eventually you will get around to updating the sources mentioned, but I think many would be grateful for a good summary ASAP.

Thanks.


#6

Thank you very much, AIW!

Now, it is getting clear, I will have a look at some Python topics. So far I was almost sure about Visual Basic because it has a graphical interface in Visual Studio Express, however as I found some sources of python integration as well into Studio. I need to dedicate time which one is easier and fit for my requests. I think I need to make a plan first. Also there are a lot of sources for VB on the net, and Python is also a really widespread language if I just think of Blender scripts and other apps. Thanks for the suggestions let’s see where it goes.


(Steve Baer) #7

Wow, that’s a lot to take on in a single reply :blush:

I have been putting effort in lately to try and update documentation on all of these python and RhinoCommon related topics, but we are still a long way from where I want us to be.


As a first thing to note, I plan on taking down the python.rhino3d.com web site and have been in the process of moving “stuff” that is on that site to either the wiki or my personal blog.

My goal is to have the primary landing page for Rhino.Python to be


and my old blog on python.rhino3d.com has been moved to
http://stevebaer.wordpress.com/
Both of these are actively being updated this week in order to try and be a bit more useful.


On Windows, I would say the easiest editor for people getting started is the one you get when you run “EditPythonScript” in Rhino. The editor has autocomplete and a debugger that allows for stepping through code and evaluating variables.
If you want to use a different environment, there are several great editors out there.

  • We use pycharm by jetbrains for developing google appengine python scripts, but we don’t use it for Rhino (at least not yet.)
  • PyDev is also popular and @frist was able to get it to work with remote debugging (very cool). http://discourse.mcneel.com/t/external-python-debugge
  • There are a boat load of other python editors out there, I just haven’t spent time researching them to be able to give any valuable feedback on them.

On OSX, there are also a large number of editors but we do not currently have “EditPythonScript”. This is very old, but I was able to use komodoedit successfully for Mac Rhino


I would say almost all of RhinoCommon has been reasonably tested. I typically only add functionality as it is needed so we can “dogfood” it. We used python and grasshopper as the “dogfood” to build RhinoCommon and it continues to be the platform that these plug-ins directly depend on to interact with Rhino.

RhinoCommon will continue to be enhanced with new functionality, so I can’t really comment on the status of intended functionality.


VB.NET will probably be easier for designing user interface since things tend to integrate nicely in Visual Studio. That being said, these same tools could be used to develop UI for python. UI is always going to be a bit of a hurdle to learn no matter what language you choose. We used to use WinForms and are now finally switching to WPF since it provides for a clean separation of UI and the logic behind the UI. It is a pretty steep learning curve for getting started with WPF though.
https://stevebaer.wordpress.com/2010/07/22/starmaker-an-advanced-sample/


I would say there is a difference. Python scripting ends up being one or more .py files, where a DLL is a compiled assembly used by the .NET framework. We haven’t put a whole lot of research into compiling python into .NET assemblies.


RunPythonScript works great on Mac and almost everything works. Where we need to make some adjustments is with scripts that use some “precanned” user interface elements like ListBox since the current user interface pieces for those functions assumes you are running on Windows. I know how to fix these, I just haven’t had the time yet.
EditPythonScript does not exist on Mac. I want to experiment with doing a better job of allowing external python editors to work with Mac Rhino so we don’t have to write a new editor there from scratch.


We need to write better tools for creating and debugging Rhino Mac user plugins. Currently, if you knew all of the proper hoops and rain dances that need to be done, you could build and debug a RhinoCommon based C# plug-in on your computer today. The problem is that there are a lot of hoops and dances still.


Hope this helps more than just cause more confusion.


#8

Well, you were certainly up to the job! Taken together, your replies constitute a pretty nice status report for today instead of a year or more ago :smile:
Even if the “date” of the report were the only thing changed, it would at least instill confidence that what it says is not out-of-date.

Thanks.


(Steve Baer) #9

I updated the python wiki page at


to contain the information that was previously on http://python.rhino3d.com/

We will probably be shutting the python.rhino3d.com site down soon since it is just one less thing that we have to maintain. Once that is done, the date issue on that page should no longer be an issue :wink:


#10

Hi Steve,

I have another question regarding rhino scripting or programming. If I create a simple software ( eg.: a simple database or just a simple form) by Visual Studio using VB how can I connect the two software together to use their data back and forth? As same way like Grasshopper’s CSV support. Because recently I was thinking about an Openoffice connection but now I would say maybe a simple new software would be more simple. However Ooffice has the same VB support as Rhino has. What materials should I study to communicate the two software with each other?


(Steve Baer) #11

I’m sorry, but I don’t understand your question. Are you just looking to write a csv file? If you are, there should be a ton of samples if you google “vb.net write csv”


#12

Hi Steve,

Hmmm., not writing csv. (However… really it is not bad idea’ !) (I will be thinking about this.)

My question is If I write a simple database standalone software in Visual Basic (collecting project data and material info for documentation) what documentation I have to study to make connection with Rhino? So how to create a link between Rhino and my standalone database (written in VB).

Back to CSV, it can be a good solution to import into rhino via plugin and than link texts with database records.

thanks,


#13

Hello everyone

I did a python algorithm rhino in the editor. I would create a plugin using the same code. What would be the next step? I read the article StarMaker of @stevebaer and tried SharpDevelop to create the user interface. Am I on the right track?

Greetings and thanks


(Steve Baer) #14

It depends on what your goal is. Many times a script written with the python editor is sufficient. If you are trying to “package” your script, you may want to look at the script compiler post that David just wrote.
http://discourse.mcneel.com/t/rhino-script-compiler-for-rhino6-first-beta


#15

Hi Steve, how far is the built-in Python editor’s intellichunk implemented ? I only get autocompletion if i start writing eg. Rhino. then after typing the point autocomplete works. But if i assign eg:

some_pt = Rhino.Geometry.Point3d(0.0,0.1,20.0)

and then start writing some_pt. after typing the point symbol, i don`t get autocompletion. Is this how it is supposed to work ?

thanks,
c.


(Steve Baer) #16

Yes, that is as far as the autocomplete works in V5. A deeper analysis of the script would need tp be performed to figure out the type of the variable,


#17

I guess that in the long run, using VS is great but also heavy just to get full autocompletion. Which editor should i recommend to work in the above scenario if the user does not like to deal with VS ?

btw. please count my wish for “deeper analysis” :smiley:

thanks,
c.


(Steve Baer) #18

It depends on which language you are typing in

If you are writing pythonor RhinoScript; I would recommend using the editor bundled with Rhino

If you are writing VB.NET, C#, or C++; I would recommend using Visual Studio


#19

Thank you @stevebaer, this is exactly what I was looking for.