Opening Rhino file and Grasshopper file on Launch

I’m using visual studio to write a grasshopper plugin. I use the built in debugger to compile the plugin then launch Rhino. As I’m sure is common, I have a specific Rhino file and Grasshopper file I use to test my components. I’ve figured out a way to open a specific Grasshopper file upon launch, and I found a way to open a specific Rhino file on launch. However, I have yet to find a way to combine the two and open both my grasshopper and rhino files on launch.

Here is the code I’m using in my .csproj file. Currently, upon launch I get a prompt to select a rhino file to open, then Rhino opens it along with the specified Grasshopper file. I would like to skip over this prompt all together.

<PropertyGroup Condition="$(Configuration) == 'Debug' AND $([MSBuild]::IsOSPlatform(Windows))">
    <StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
    <StartArguments>
		/runscript="_-RunScript (
		set GH = Rhino.GetPluginObject(""Grasshopper"")
		Call GH.OpenDocument(""Z:\Shared\Estimating\Computational Design\Cameron's Parametric Tools\Toolshed\KHSS Tool Shed\KHSS Tool Shed\Testing\Test File.ghx"")
		)" "Z:\Shared\Estimating\Computational Design\Cameron's Parametric Tools\Toolshed\KHSS Tool Shed\KHSS Tool Shed\Testing\Planar Framing Test.3dm"
	</StartArguments>
    <StartAction>Program</StartAction>
  </PropertyGroup>

Update: I’m trying this new code and it still doesn’t work. Upon launching rhino, I instead get the window’s explore file selection window to open a .3dm file. The grasshopper never launches.

    <StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
    <StartArguments>
		/nosplash
		"Z:/Shared/Estimating/Computational Design/Cameron's Parametric Tools/Toolshed/KHSS Tool Shed/KHSS Tool Shed/Testing/Planar Framing Test.3dm"
		/runscript=""-grasshopper solver enable load document open "Z:\Shared\Estimating\Computational Design\Cameron's Parametric Tools\Toolshed\KHSS Tool Shed\KHSS Tool Shed\Testing\Test File.ghx" _enter""

	</StartArguments>
    <StartAction>Program</StartAction>
  </PropertyGroup>

Maybe doing this is easier?

– Dale

That could work. Is that limited to just a specific 3dm file or would that command happen for all rhino files? I would want the former and not the latter since I only need the specific gh file to open when I open a specific rhino file.

Also my code above is still not opening the specified rhino file. It open rhino with nothing, then asks me to choose a file to open.

OK, I’m really confused.

Why do you need to load a specific .GH file when starting a debug session? Why not just start the session and open a file?

– Dale

I’m trying to be efficient. When I debug a project, I’m typically opening the same rhino file and grasshopper file. That takes extra time a clicks to click play on VS, wait for it to compile, Open rhino, wait for that to finish loading, open my rhino file, wait for that to load, open my grasshopper file, wait for that to load, then finally inspect the component to see if it behaves correctly. This whole process can take several minutes and it would be ince to reduce it down to a single click.

1 Like

it would also be very helpful in general to be able to have a Rhino template file that automatically opens certain GH files with it, as opposed to opening a particular GH file every time rhino opens.

Example: template file I use for doing a certain type of CNC toolpathing would be better if it could automatically open some GH documents I use to make toolpathing faster. Not just for my convenience, but for enterprise use, so everybody working with me can use the same template and GH templates with one click. it seems trivial but getting everybody to use the same methods is, in fact, harder, if they need to open four different files to follow a procedure than if they need to only open a template file and all the GH they need pops up with it.

1 Like

you should probably have a look here: 5.9 Speeding Up Grasshopper Development - Advanced Development in Grasshopper - YouTube