Headless Rhino with custom plugin

Hello,

I am using rhino with an in-house plugin to convert data on a windows server.
The goal is to run Rhino 8 headless from a background task.
It works when i start the script in a dedicated (sudo/run as, with a different user profile, to be able to run 2 different versions of the same plugin) shell, but not as a background task (to automatically start after windows startup). note, it worked with rhino 5 (i modified the script to call rhino 8).

The question is, is this still possible with rhino 8 ? if not what are my options ?
(note : rhino is called by a script which is called by a java servlet. rewriting the servlet in c# would be an option)

Best Regards
-Thierry-

1 Like

looks like the same issue:

@dale
Did you find time ?

thanks
cheers
tom

seems rather different.
In our pipeline, we start rhino from the background task and exit (with _autoclose) once the processing is complete. tasks are serialized using mutexes in the powershell (ps1) script

It might be a way to go around the problem though (but requires rewriting the servlet in c#)

regards
-Thierry-

Hi @Thierry_BOCK,

In order to help, I’m probably going to need some way of repeating.

– Dale

Could you use Rhino.Compute for this instead?

1 Like

sorry for the delay, took me a little to put together the minimum testable set.

  • all the following assumes a secondary user with name “dev” with home “c:\Users\dev” and Rhino installed as “C:\Program Files\Rhinoceros 5 (64-bit)\System\Rhino.exe” and “C:\Program Files\Rhino 8\System\Rhino.exe”

  • rename the following powershell (remove .txt)
    dryrun.ps1.txt (771 Bytes)
    Note : move the comment (#) on lines 9/10 before $rhinoproc to switch between rhino 5 and 8

  • create a scheduled task running under a different user (task scheduler) which calls the script and run the task
    in General :
    → change user or group (to sth not the active or logged user)
    → run whether user is logged or not
    in Actions:
    → New :

    • program/script :
      C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • Add arguments :
      -Command C:\Users\dev\dryrun.ps1

when starting the script, it script will create/append to the file C:\Users\dev\run.log. When run from a terminal, you will see the rhino windows pop into view and exit (as expected), not when run from a background task, but rhino 8 will stay as running in the task manager until killed either by hand or by the timer (5 min).

starting Rhino 09/12/2024 17:19
System.Diagnostics.Process (Rhino)
done waiting
rhino exited with code : 0

is a successsful run

starting Rhino 09/12/2024 17:16
System.Diagnostics.Process (Rhino)
done waiting
rhino exited with code : -1

is a failed one (ie. rhino i killed by the timer)

It is possible that Rhino is stuck at a prompt, but it is not something i can check.

-Thierry-

doubt it. if i understand correctly what rhino.compute is, it would require rewriting the plug-in entirely (and the plugin has both a scripted and an interactive version)

Hi @Thierry_BOCK,

What does the plug-in do? Just curious…

– Dale

It has two main tasks (called in order):

  1. Converts furniture specifications (shape, accessories,…) to 3d data (complete with all milling, and drilling)
  2. convert the data to something importable by the CAM program used by our partners (configurable by the carpenter, usually dxf with named layers)

and it is possible for my colleagues to take over step 1, in case of specific (ie. that are not defined in the spec) demands/requirements (with an UI)

-Thierry-

Hi @dale

Have you tried to reproduce it ? any ideas ? or suggestion to go around the problem (using rhinoscript with external access maybe ?)

Best regards,
-Thierry-