Run PythonScript without GUI

Hello everyone,

I’ve written a Python script which allows me to generate a geometry based on a number of variables. All I have to do is start Rhino, set the variables and run the script. I was wondering if it was possible to run the PythonScript without ever starting the GUI, preferably from CMD or Powershell. All imports exports are automated anyway.

1 Like


Does this help?

1 Like

I’m pretty sure that this should allow me to pull this off.

This does not work from Powershell but it does work from CMD.

However the -RunPythonScript -exit command does not close Rhino. Rhino remains open. It seems to try and run the -exit command as part of the Python Script

Also, isn’t it possible to run it without the GUI?

OK so it can now be done if I use rs.Exit() in the python script.

But this still requires a GUI. I want Rhino to stay closed, basically just doing it’s thing silently without ever popping up in my screen. Is this possible?

1 Like

I don’t know a way to do this. Have you disabled redraw to minimise the cost of the gui?

Hi @SNC,

To “run” Rhino without a GUI, you’ll need to automate Rhino using ActiveX automation.

Here are a couple of examples you can review:

– Dale

Why don’t you try rhino3dm and compute-rhino3d modules for CPython?

Thanks. I’ll give it all a try!

Very interesting! Would this work for open many dxf files in Rhino, deleting all points and exporting each one as a 3dm file? I’m looking for a way to do this without opening the GUI as the millions of points in each file make it extremely slow.

Thank you in advance!

Quick search gave me this result:

This is supposedly a module that will allow you to create and modify DXF files.
Should be better solution.

simple example of deleting all points in dxf file:

import sys
import ezdxf

    doc = ezdxf.readfile("points_.dxf")
except IOError:
    print(f"Not a DXF file or a generic I/O error.")
except ezdxf.DXFStructureError:
    print(f"Invalid or corrupted DXF file.")

model_space = doc.modelspace()

for e in model_space:
    if e.dxftype() == "POINT":

1 Like

Yes this should work well ! ezdxf works well and you can quite easily delete all points, then save back to dxf before opening the dxf in Rhino.