Rhino Script Compiler for Rhino5, second Beta

Hi @stevebaer
I am sorry for nagging on this, but I would really like to know when I can complete the project.

-Jørgen

Sorry, still high on my list.

Ok, I’ll work on the new webpage in the mean time, but please hurry, I want to move on to the next project :wink:

Steve,
Can the compiler deal with Pickle files? I’ve got a set of pickle files that my scripts reference and would like the information in the pickle files to go with them.
Thanks

No, the compiler does not embed pickle files into your rhp. That being said, you should be able to include any type of file in your RHI which is just a renamed zip file.

Ok,
So then my workflow for making a plugin made of multiple python scripts should be as follows?

  1. Compile the python scripts into a *.rhp
  2. Zip the new *.rhp with the pickle files, help file, ect.
  3. rename the .zip file as a *.rhi

Thanks

That looks correct

Hi Steve, any news on my issues?

On vacation last couple of days. Hoping to look at this on airplane ride home tonight

Nah, leave it for next week and enjoy the last part of the vacation!
You deserve it :smile:

Hi all,

-Rhino 5 SN4 & .NET 4.5 installed
-Tried with several different “rvb” files, but keep getting the error.
Do you have any suggestions?

Thank you,
Ahmet

By SN4 do you mean you have service release 4? If that is the case, please update your Rhino to the latest service release to see if that fixes the problem.

Thanks Steve,
Updating Rhino to the latest service release, solved it. But I’m a bit sad since, a user who has a previous release won’t be able to install the plug-in.

Hi Steve,
anything I can do to help solving the conversion issue?
I need this for a job now, not only for Holomark2.

I’ll jump through burning loops if that helps :smile:

I’m currently working on a round of optimizing V6 to load as fast as possible. This should take another day or two. Once that is done, this issue is next on my list to investigate.

Ok, fabulous, and I am happy to play with V6 in the meantime… :smile:

1 Like

I think I figured out what was going wrong with your script. I can try to fix this in the core in the future, but for now here is a simple change you can make to get your script running.

At the beginning of your script, add another import

import scriptcontext

Right after you call the command that creates a new file, set the scriptcontext doc to the new active doc

...
rs.Command("_-New _None",False)
scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
...

I need to adjust the core to account for when the document changes in a script. The scriptcontext.doc variable was pointing at the old closed document and was therefore not giving valid results when things like views were being looked up.

Ok, that makes sense in an odd way :smile:

Thanks for figuring this out Steve!

Success!! This seems to work.

Now I need help on the “locate plugin folder” issue, where only a few of the installed plugins folders can be found. (See this thread Plugin install folder? )

I found another bug that crashes both the script and Rhino and that is a “check for ESC” function I have, it doesn’t work when converted to a plugin. And if I press and hold ESC down for a while (3 seconds) it crashes Rhino. Speedy crash, Rhino just disappears.

Here’s the ESC test:

    def CheckForESCpress():
        if scriptcontext.escape_test(False):
            rs.DocumentModified(False) #Sets modification to null
            rs.Command("_-New _None", False)
            scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
            rs.EnableRedraw(True)
            rs.AddText("Holomark 2 was terminated by ESC", (-15,0,0), height=1.5, font="Century Gothic", font_style=1, justification=None)
            exit()

I tried disabeling the “make new document part”, and now it doesn’t crash, but it doesn’t terminate either.

Should I use something else than “exit()” ?