Grasshopper

algorithmic modeling for Rhino

how to query version number of own GH addon & installed GHpython?

Dear Reader,

For administration purposes it is useful to access the version "number" of our custom GH addon (.net) and the installed GHPython during run-time. The programming "scope" is a component in our custom GH addon. I have the following questions:

    How would you manage and query the version of our own custom addon?
        E.g. query assembly version number, but how?
        Is there trick to "update" the version number with GIT tag?
    How to query the installed GHPython version number?
        (the query is not done in a script component)
        E.g. iterate installed addons, but how?
        If the GHPython addon is found, how do get the number?

Greetz,

Wei Pien

Views: 237

Reply to This

Replies to This Discussion

I found this lead regarding list of adding and have a look at that

http://www.grasshopper3d.com/forum/topics/pulling-grasshopper-metad...

All the information that Grasshopper has about loaded plugin is available via the Grasshopper.Instances.ComponentServer class. You can use methods like FindAssembly[ByObject]() or the Libraries property to enumerate over all of them. Yes, the naming is terribly inconsistent.

These methods all return GH_AssemblyInfo objects, which give you the name, version and location of the relevant assembly. You can get this information about all loaded plugins, including your own and GhPython.

To build a list of all GHAs used in a particular document, you'll have to loop over all IGH_DocumentObjects and find the associated GH_AssemblyInfo objects. Grasshopper does this internally when saving gh files, but I did not make that logic public.

I have no idea how GIT fits into this, may be a question for Will Pearson over on discourse.mcneel.com. He's our resident versioning/github expert.

tnx David, that works. I have a generic function now that gets the assembly version by means of its guid id.

You can also get the GHPython version like so:

Tnx Anders (confusion first name for a Dutch man;)) for your response, I want to access this info however from a custom component. Furthermore, I want to do that even when in the same document where this custom component has been put no python script component exist.

So I think query the installed add-ons via grasshopper as David suggests should be the way I think.

Hehe, that's what the Germans say as well ;) 

Yeah in that case you're definitely looking at a solution like David is proposing.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service