RunScript Headless

Hi,

I’m trying to run commands in a headless document. However, it seems that the commands that work in a non-headless document don’t work in a headless document.

In the example below, I’m being prompted to specify the point position:

import Rhino

doc = Rhino.RhinoDoc.CreateHeadless(None)
Rhino.RhinoApp.RunScript(doc.RuntimeSerialNumber, "Point 0,0,0", False)
doc.Dispose()

However, this works:

import Rhino

doc = Rhino.RhinoDoc.ActiveDoc
Rhino.RhinoApp.RunScript(doc.RuntimeSerialNumber, "Point 0,0,0", False)

What am I missing?

Best,
Johan


Rhino on Mac, 8.10.24228.13002, 2024-08-15

@Johan_Lund_Pedersen What is not working exactly? I can query the objects in headless doc and see the point:

Hi @eirannejad

Thank you for getting back to me. I just tried the example above on Windows, and it seems to work there. So, I believe this issue is related to Mac.

When I run it on Mac, it looks like this:

Oh I see. It keeps prompting for point selection. Definitely a bug. I have filed a YT for this here:

RH-83659 RunScript does has unexpected behaviour on headless docs

2 Likes

Hi @eirannejad

Thank you! Much appreciated.

Best,
Johan

1 Like