Can I call a rhp running inside rhino from Outside Rhino?


#1

Hi,
I am developing my .Net code in F# in VS.
Is there a way that I can draw lines an points from a dll that does not run inside rhino?
I thougth about creating a little helper rhp, that just draws lines and points, load it in Rhino. and then call this one to draw my debug stuff from the scripting REPL in VS.
would that work?


(Menno Deij - van Rijswijk) #2

I suppose that you can always open a socket connection on the local machine and listen for messages. The REPL can send messages, the RHP can respond to them by drawing.

Other than that, there is the automation interface. For more info see https://github.com/mcneel/rhinocommon/tree/master/examples/AutomationSample

Basically, you can send any script call to an instance of Rhino from a different process.

HTH,

Menno


#3

thanks Menno,
I assume sockets is more performant if I draw thousands of lines? Are Sockets the best Way to have two .Net Apps talk to each other ? ( I never used sockets before)


(Menno Deij - van Rijswijk) #4

Sockets is the most low-level communication possible, you need to define your own message format and implement a lot of overhead: listening, buffering, etc. Maybe not such a brilliant suggestion after all…

Maybe take a look at WCF (Windows Communication Foundation) and/or Named Pipes (see for example this http://www.codeproject.com/Articles/7176/Inter-Process-Communication-in-NET-Using-Named-Pip)


(Alain Cormier) #5

I have a crude plug-in assembled from bits that I found in various open source projects which basically listens for http requests containing F# code and then compiles and runs it sending back the std out as the http response. The client side is just a command line utility with no integration with VS. The Express versions of VS cannot easily be extended anyway.

Another hack is that I have a plug-in that wraps NUnit and I write F# code as unit tests and have it load that way.

Not ideal solutions and at some point I’d like to take the time to come up with a real solution but until then that has worked for me.


#6

Thanks for your link Menno, I’ll try COM, since the examples should make it easier and the performance seems to be the same as with WCF:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/adb79021-89b8-47ab-a02d-33b2e777cb73/wcfcom-performance-comparison?forum=wcf