RhinoCommon into VS interactive console

Hello,

I regularly use the C # interactive console to test an expression.
but i can’t access any features outside of .NET libraries.

May be a licensing issue.

Do you have an idea?

Thank, jmv.

Hi @kitjmv,

RhinoCommon is dependent on Rhino (e.g. Rhino.exe). Thus, if Rhino is not running, most RhinoCommon methods will not be accessible.

– dale

I haven’t tried this yet, but I would imagine this would work with Rhino.Inside and V7

Hello @dale
unfortunately, even with Rhino running (inside VS in debug mode or not) the result is the same.
Hello @stevebaer
I have concluded that a VS extension with “Rhino.Inside” can provide an interactive console for Rhino. but I don’t know how to write a VS extension.
I was hoping to find a solution here :slight_smile:
thanks to you two

Can you reference a nuget package? If so, you can try referencing Rhino.Inside at
https://www.nuget.org/packages/Rhino.Inside/

I’m pretty confident this can be done, but haven’t personally had time to try and experiment with it. Here’s a .NET console app that uses Rhino.Inside which is what I think we can replicate in a REPL

@stevebaer! It’s really simple !!

image

There is no need for the NuGet library, just a reference to the RhinoCommon.dll assembly. (and new RhinoCore())
Thanks for the links

jmv

Note: It is important to call rc.Dispose () before exiting VS or resetting the console. Otherwise, you have to restart the PC to reconnect. (before losing the variable rc)

1 Like

There ya go! thanks for letting me know it works

now I ask myself a question.
If new Rhino.Runtime.InProcess.RhinoCore () can integrate all the features of RhinoCommon into another process.
Why“Rhino.Inside” is necessary to integrate Rhino into our applications?

Rhino.Inside sets up Rhino so it runs as a library inside of another process.

Ok, I don’t understand the difference between VS REPL console and application console like your example.
but being able to test expressions without running Rhino will be of great help )

Since only one RhinoCore instance can be created, it would be useful to have this instance in a RhinoCore.Instance field. I keep losing her all the time.

Can you use static in the REPL? static var rc = new RhinoCore();

Yes we can, but that doesn’t really help. Static or non-static fields are cleaned with the console.
It’s not so bad, We initialize once in the morning and the console remains open until the evening …
you just don’t need to do a # reset

I’m not familiar with the C# REPL in VS code. Can you explain the problem a little more to me?

To be honest, I can’t. I don’t understand the behavior of the console.
That i know,

In the end, this is probably not the right method.
Don’t waste time just for me. When it works, it’s good. When that doesn’t work I open a Grasshopper script component.

We agree, we are talking about Visual Studio 2019 and not Visual Studio Code