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

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

Properties

Assembly

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

Author

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

Contact

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

DefaultLicence

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

DocumentationFolder

#
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.
public virtual string DocumentationFolder { get; }

ExportedTypes

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

Icon

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

Id

#
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.
public Guid Id { get; }

Info

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

LicenceAgreement

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

LicenceDescription

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

Location

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

Name

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

PluginDocumentObjectTypes

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

SatelliteAssemblies

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

Version

#
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).
public virtual Version Version { get; }

Website

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

Methods

HarvestCustomTypes

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

Loaded

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

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.
public virtual void OnLoaded()

OwnsAssistant

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

OwnsDataType

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

OwnsObject

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

PlugInDescription

#
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.
protected string PlugInDescription(
kind
Which piece of plugin description to read.
)