Opening a new instance of Rhino in Python

Trying to get a rhino window to send a command to open a new instance of rhino opening a particular file. All the commands in Rhino.RhinoDoc seem to just do it within the ActiveDoc window.

To reiterate, I wan’t to run a command that will open a NEW instance of Rhino.

Hi @matthewaustin233,

You might just script _Run using rs.Command() and pass a valid file_path in quotes, eg.

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
import System

def OpenFileInNewRhino(file_path):
    if not System.IO.File.Exists(file_path):
        print "File not found: {}".format(file_path)
        return False
    cmd = "_-Run {}".format(chr(34) + file_path + chr(34))
    return rs.Command(cmd, False)

def RunCommand():
    file_path = r"C:\Users\UserName\Desktop\TestFile.3dm"
    rc = OpenFileInNewRhino(file_path)
    print "Result: {}".format(rc)



1 Like