public abstract class Plugin
Every grasshopper plugin assembly must implement a single public type with a public, parameter-less constructor derived from this class.

Constructors

Plugin

#
protected Plugin()
Base constructor. Plugin identity (id, name, info and version) is by default sourced from assembly attributes — see the individual properties.

Properties

Assembly

#
public Assembly Assembly { get; }
Gets the plugin assembly.

Author

#
public virtual string Author { get; }
Name of plugin author. By default this is read from the Rhino [assembly: PlugInDescription(DescriptionType.Organization)] attribute, falling back to [assembly: AssemblyCompany].

Contact

#
public virtual string Contact { get; }
Contact details of plugin author. By default this is read from the Rhino [assembly: PlugInDescription(DescriptionType.Email)] attribute.

DefaultLicence

#
public static string DefaultLicence { get; }
Gets the default description for licences which tracks the Rhino licence, based on the the local user name and organisation.

DocumentationFolder

#
public virtual string DocumentationFolder { get; }
Gets the documentation folder for this plugin. Ideally this folder contains subfolders for supported languages such as "English" and "Deutsch" etc. Grasshopper will then know which one to pick based on current language settings. If no language subfolders exist, the folder contents are used directly. By default, any folder called "Documentation" next to the plugin assembly will be returned, or otherwise the folder which contains all *.term, *.spec, and *.topic files within the assembly folder.

ExportedTypes

#
public IEnumerable<Type> ExportedTypes { get; }
Iterate over all exported types in the plugin assembly, and all satellite assemblies.

Icon

#
public virtual IIcon Icon { get; }
Gets the icon for this plugin. The icon may be null.

Id

#
public Guid Id { get; }
Gets the ID of this plugin. By default this is read from the [assembly: Guid] attribute, which is the same id Rhino uses to identify the plugin.

Info

#
public virtual string Info { get; }
Gets a short description of this plugin. By default this is read from the [assembly: AssemblyDescription] attribute.

LicenceAgreement

#
public virtual string LicenceAgreement { get; }
Gets the licence agreement text for this plugin. If the agreement string starts with 'http' or 'www' a web-address lookup is implied.

LicenceDescription

#
public virtual string LicenceDescription { get; }
Gets the licence description for this plugin, for example 'trial', 'commercial', 'free', 'educational'...

Location

#
public string Location { get; }
Gets the location from which this plugin was loaded.

Name

#
public virtual string Name { get; }
Gets the name of this plugin. By default this is read from the [assembly: AssemblyTitle] attribute.

PluginDocumentObjectTypes

#
public IEnumerable<Type> PluginDocumentObjectTypes { get; }
Iterate over all IDocumentObject types this plugin exposes.

SatelliteAssemblies

#
protected virtual Assembly[] SatelliteAssemblies { get; }
Override this method if this plugin has satellite assemblies which provide additional components, conversion methods, type assistants etc.

Version

#
public virtual Version Version { get; }
Gets the version of this particular build of this plugin. By default this is read from the [assembly: AssemblyFileVersion] attribute, which is the same version Rhino reports for the plugin (the build date stamp).

Website

#
public virtual string Website { get; }
URL of plugin home page. By default this is read from the Rhino [assembly: PlugInDescription(DescriptionType.WebSite)] attribute.

Methods

HarvestCustomTypes

#
protected virtual void HarvestCustomTypes()
Perform custom type creation, in case your plugin does not ship with compiled types.

Loaded

#
public bool Loaded()
Gets whether the plugin has been loaded by GH2

OnLoaded

#
public virtual void OnLoaded()
This method will be called after type harvesting completes, but before the plugin is added to the available framework. Throw from this method to prevent this plugin from becoming available.

OwnsAssistant

#
public bool OwnsAssistant(Type type)
Gets whether this plugin owns a particular type assistant type.
type (Type)Type of an ITypeAssistant or ICurveAssistant implementation.
True if this plugin owns that type.

OwnsDataType

#
public bool OwnsDataType(Type type)
Gets whether this plugin owns a particular data type.
type (Type)Type to search for.
True if this plugin owns that type.

OwnsObject

#
public bool OwnsObject(Type type)
Gets whether this plugin owns a particular document object type.
type (Type)Type of an IDocumentObject implementation.
True if this plugin owns that type.

PlugInDescription

#
protected string PlugInDescription(DescriptionType kind)
Reads a Rhino PlugInDescriptionAttribute of the given kind from the plugin assembly, returning an empty string when it is absent. These are the same attributes Rhino's plugin manager reads.
kind (DescriptionType)Which piece of plugin description to read.