Greetings. We are working on an in-house developed GH plugin and looking for a solution to put GH userobjects in a machine for all users. Is there a way/place we can put the userobjects for all users?
Thank you
Greetings. We are working on an in-house developed GH plugin and looking for a solution to put GH userobjects in a machine for all users. Is there a way/place we can put the userobjects for all users?
Thank you
Here’s the code which finds all the folders from which GH1 will try to load user objects.
So it seems that if your user object file is sitting next to an RHP plugin which Rhino loads, then it should be found. You may need to install a blank Rhino plugin to leverage that workaround…
This property can be accessed via the Grasshopper.Folders class, in case you want to see what it returns.
''' <summary>
''' Gets a list of all the directories from which GHUSER files are loaded.
''' GHUSER files are loaded from subfolders as well.
''' </summary>
''' <returns>A list of load target directories.</returns>
Public Shared ReadOnly Property UserObjectFolders As List(Of String)
Get
Dim directories As New List(Of String)
directories.Add(DefaultUserObjectFolder)
For Each folder As DirectoryInfo In HostUtils.GetActivePlugInVersionFolders()
directories.Add(folder.FullName)
Next
Return directories
End Get
End Property
David:
Thank you very much for your response. I am forwarding your comment to my colleague and see if they know how to utilize the script you provide to our task.
If you don’t mind, would you please elaborate a little bit more of how it works? Here’s what we are trying to achieve -
We have two sets of files that needs to be copied to user profiles -
We hope that these two set of files can be copied to user profile when users launch Rhino in our environment. You mentioned that we need to have a blank Rhino plugin installed to make it work. Can you tell us which folder exactly we should use to put this blank Rhino plugin/Dependencies/Userobjects to make this works?
Thanks again!
If the dependencies are just dlls, then they don’t have to be anywhere specific. If they are next to the assembly which needs them then the .NET framework should be able to find and load them automatically. If all that fails you can even handle the assembly resolver event in case you know exactly where to find these files.
There’s various folders where GH looks for all manner of 3rd party stuff. There’s usually a default folder which is specific to individual users, but since Rhino plugins can be installed and loaded from pretty much anywhere, then that allows you to include a specific folder which might be shared amongst all users. I don’t know the answer to “…which folder exactly we should use…”, I’m not great at the installer and admin parts of software. There must be some Microsoft guidelines somewhere about where to install files that ought to be available to all accounts on a machine.
You may be able to create a Yak package that does all you want. @will can help you with that. Benefit is that it would work on Windows and Mac OS, and you get automatic versioning updates thrown in for free.
So it seems that if your user object file is sitting next to an RHP plugin which Rhino loads, then it should be found.
@DavidRutten Before firing up Visual Studio to try the blank plug-in hack, as a test I put some *.ghuser files in “C:\Program Files\Rhino 7\Plug-ins\Grasshopper”. This folder contains GrasshopperPlugin.rhp which is obviously a plug-in that is loaded. However, the user objects did not show up in grasshopper. Am I missing something?