Run script from Windows command prompt with open Rhino

I can run scripts at startup with Rhino.exe /runscript="-command -secondCommand" (https://developer.rhino3d.com/guides/cpp/running-rhino-from-command-line/).

However, I would like to run scripts from the Windows’ command prompt without starting Rhino everytime.

It might sounds like a weird idea, the reason behind all of this being that I need to control everything from a Python script (thus Rhino is currently called using subprocess.run()).

If you do not at all to start Rhino, but use its geometry computation you can use CPython3.x modules rhino3dm and compute-rhino3d

https://discourse.mcneel.com/c/serengeti/rhino3dm
https://discourse.mcneel.com/c/serengeti/compute-rhino3d

Seems to be exactly (or almost) what I was looking for! Thank you!

However, it does not recognize the command rhino3dm.File3dm(). How do I open an existing Rhino 3dm file?

model = rhino3dm.File3dm()
model.Objects.AddPoint(1,2,3)
model.Write("Point.3dm", 0)

I assume since there’s model.Write(), there’s also model.Read() :stuck_out_tongue_winking_eye:

Search the forums there are probably plenty examples.

doc = rhino3dm.File3dm.Read(path_to_3dm)

Got it! Thanks very much @stevebaer and @ivelin.peychev!