BUG: Plug-In command as alias fails on first execution

Hi,

Plug-in command assigned as an alias fails on first execution every Rhino session.

Steps to repeat:

  1. Build a plug-in with the following test command RHTest in Rhinos ScriptEditor:
#! python3

import rhinoscriptsyntax as rs


def RHTest():
    value = rs.GetString()

    print(value)


if __name__ == '__main__':
    RHTest()
  1. Install the plug-in (.yak) and assign an alias AA with the macro _RHTest HelloWorld
  2. Close the Rhino application completely and reopen it afterwards.
  3. Run the alias AA that you assigned in step 2 (it does not behave properly).
  4. Then run the same alias again (it now works as intended).

Observations
The first time the alias is run after starting Rhino it prints; “Unknown command: HelloWorld”. The second time the alias is run it correctly prints; “HelloWorld”.

Expected behavior
The alias should always print “HelloWorld”.

Video
(Observe all printed messages in the command history in the lower left corner)

systeminfo.txt (4.4 KB)
RHTest.py (146 Bytes)

This bug is kinda annoying tbh. A lot of my macros (aliases) always fails on first execution during each new Rhino session.

Included a test plug-in below (drag and drop into Rhino) if anyone would like to try and reproduce;

rhalias-0.1.42754.9024-rh8-any.yak (8.5 KB)

  1. Install the plug-in (.yak) above.
  2. Assign _RHTest HelloWorld to an alias.
  3. Restart Rhino.
  4. Execute alias from step 2.

@AMG The first time you run a command (published from script), it needs to load the languages that run that script. I suspect/can confirm that the progress bar is NOT showing that shows the load progress of languages.

Would you mind testing something for me real quick. Run your command in a fresh instance of Rhino, and wait for a few seconds. I think the prompt will show up but it takes a bit of time the first time. I made this ticket to fix the progress bar not showing

RH-83810 Published scripts do not show language load progressbar

The prompt shows up (after a delay), but when I assign the macro _RHTest HelloWorld to an alias, I want to automatically provide the value “HelloWorld” to the command implicitly each time the alias is executed. This fails the first time the alias is executed, probably because of the language loading you mentioned. Afterwards, it behaves and executes correctly.

1 Like

Okay. I will make sure this works/fixed and will send you a build that has the fix for testing

1 Like

Perfect, thank you.

Hi @eirannejad, I am seeing similar behavior on my end as well with a compiled command I’m calling “loadui”.

Previously I would load Grasshopper and have this command follow that action to then load the ui.
Now, what is happening is that it always says “unknown command: loadui” the first time but then works just fine if I run it again or type “loadui” directly in the command line.

Let me know if you need any files from me, thank you so much!

1 Like

Okay I am pushing a fix for the missing progress bar. The fail-on-first-run is definitely a Rhino-mac-specific behaviour. I can not replicate this on Windows.

@michaelvollrath are you on Mac as you are seeing similar behavior as me?

I am seeing the behavior on Windows but developing on Mac as well. I just haven’t tested this portion of it on Mac yet aka I need to test yet

Are you executing the commands from an alias with hard-coded input values (_RHTest HelloWorld instead of just _RHTest)?

I found where the problem is with running the alias and so far I am pretty sure it is macOS specific. @michaelvollrath Would you mind sharing an example of this happening on Windows? I can not get Win to repeat this behaviour

Sure thing, I’ll shoot you a message!

EDIT:

Okay in further testing I believe it was a complex string sequence causing an escape character to trigger a command interruption… leading it to “look” very much like the behavior in this post but different…

Alias seems to work fine for me on Windows.

Thanks for following up with me @eirannejad !

1 Like

I have pushed a fix for this bug and the change is being reviewed by the team. I’ll keep you posted on the progress :smiley:

3 Likes

Awesome, thank you :grinning:

1 Like

RH-83810 is fixed in Rhino 8 Service Release 13