Problems loading GHPY assembly

This is a different issue from the previous comment I made: how do you install these custom made components onto someone else’s Rhino 6? I’ve tried placing the .ghpy components inside the Grasshopper -> Libraries file, as well as Grasshopper -> Components file, and dragging and dropping them into the GH window too, but none have worked. Do I need to write an installation script or assembly (.gha) file to do the installation?

Also, just wanted to double check, but custom components compiled in Rhino 6 WIP are not viable for use in Rhino 5, or has this changed?

That’s how it works. The easiest way is to place them in the folder that opens when you press
File → Special Folders → Components folder. Please note that Rhino 5 and Rhino WIP and 6 will have two different locations for these folders. The one for Rhino 6 is %appdata%\Grasshopper\6\Libraries.

That is correct, sorry, that’s how it is.

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thanks for the reply. I’ve already tried to put them in the File -> Special Folders -> Components, but the components still don’t show up in the Grasshopper options even after restarting the entirety of Rhino WIP. What could I be overlooking here?

Hm, that’s a shame. Is there any other way to develop custom components using Python script for Rhino 5?

Could you try the location I just mentioned?[quote=“Bianchi, post:39, topic:38552”]
Thanks for the reply. I’ve already tried to put them in the File -> Special Folders -> Components, but the components still don’t show up in the Grasshopper options even after restarting the entirety of Rhino WIP. What could I be overlooking here?
[/quote]

I am queuing this up after the other question:

It’s possible that there are some conflicts due to that problem. After that, I’ll check back with this one.

There are some in-betweens, like compiling with clr.CompileModules() and then have a normal GhPython component load that module, but I don’t think something like this is available in 5.

Yes, I tried that location as well, didn’t work too. :frowning:

Again, please queue up this question after

is solved.
There is no way a computer can load that invalid assembly, so there is nothing to check here at the moment.

Okay, thanks again for the help.

From what I can understand, this problem in loading the GHPY assembly may be due to the same one causing issues with compiling certain components using the single component method?

UPDATE: I’m aware that this issue is postponed, but just updating this topic with some other errors that have cropped up when I tried to install the single-compile components on another PC’s Rhino WIP. The components work even after closing the error dialog box, but I’m wondering what’s causing this issue.

No, it’s something else.
The first thing to understand is, why your .ghpy file is not a valid assembly?

This is yet another bug. You need to learn to patiently debug, it’s the art of programming that requires that.
In this particular case, I think I saw that type of exception a long time ago in WIP, but it was gone.

Please, btw, compile all your components in a single .GHPY file. Creating dozens of .GHPY files for a single add-on is not useful for users.

Hm, for this bug, do you remember what usually causes this GH breakpoint to pop up? Or could suggest anything I could read that would help?

Thanks for the suggestion. This means that I should use the clr.CompileModules to compile all of the components → the codes for each of the components are placed into one file? I’ll try doing that, but as the ‘sortal’ file itself is a group of separate files that number in the thousands and that all import from each other, I’ll tinker around with clr.CompileModules first and see what happens.

Did you write sortal? If not, what’s the point of compiling it?
You should rather point to its source, in that case.

My colleague wrote the main package (it’s a library that does shape grammar operations and has certain special classes), and it’s a bunch of different scripts, so I’m testing if importing the whole package will work, i.e. from sortal import *, because I usually use that to import the whole thing.

On, I see!

In this case, I think you will have to add all its files to clr.CompileModules(). You could have a few lines before that automatically scan the whole sortal directory.

Thanks for the suggestion. Still tinkering around with clr.CompileModules(), I’ll get back here with the results if anything interesting comes up.

@Bianchi, cool! What clr.CompileModules() really does, is dump the intermediate representation that is used by IronPython into a file. As such, I think compilation for many files should also be possible. I’d be happy to see if I can help also if you get stuck at any place. Have fun!