GH_ComponentServer
ReferencesMaintains proxies for all components, parameters and other object types as defined in all grasshopper assemblies.
Constructors
GH_ComponentServer
#public GH_ComponentServer()
Properties
AllAddOns
#obsoleteThis property has been replaced by the ExternalFiles() Shared method
Gets a list of all the gha and ghuser files that will be loaded as Grasshopper add-ons.
Returns: A list of target file paths.
CompleteRibbonLayout
#Gets the default component layout featuring all non-hidden components and parameters.
DiscardedProxies
#Returns the total number of IGH_DocumentObjects that were discarded during assembly parsing. This includes both skipped and replaced proxies.
GHA_AppDataDirectory
#obsoleteThis property has been replaced by Grasshopper.Folders.DefaultAssemblyFolder
GHUser_AppDataDirectory
#obsoleteThis property has been replaced by Grasshopper.Folders.GhUserAppDataFolder
IsLoading
#Gets whether the component server is currently executing its external-file load pass. True from entry to LoadExternalFiles until it returns.
LoadingExceptions
#Gets a list of all the exceptions that were recorded during the most recent loading sequence.
ObjectProxyNames
#Returns a specialized string collection of all component names.
Remarks: This property is used for autocompletion in textboxes.
TypeHints
#Gets a list of all IGH_TypeHint types in all loaded assemblies.
Returns: A list of System.Type containing all classes that implement IGH_TypeHint.
Methods
AddAlias
#Add an alias to a target.
AddCategoryShortName
#Add an abbreviation for a tab category. 2~4 letter abbreviations are best.
AddCategorySymbolName
#Add a single char category description.
AddProxy
#Add a proxy object to the component server. Expert user function, talk to David Rutten before calling it.
Parameters:
| proxy (IGH_ObjectProxy) | Proxy to add. |
Returns: True on success, false on failure.
AddProxyLibraryInfo
#[EditorBrowsable(EditorBrowsableState.Never)]
public bool AddProxyLibraryInfo(GH_AssemblyInfo assemblyInfo)
Add a library info for a proxy object to the component server. Expert user function, talk to David Rutten before calling it.
Parameters:
| assemblyInfo (GH_AssemblyInfo) | Library info to add. |
Returns: True on success, false on failure.
AliasTargets
#Get all the target Component IDs for a given alias.
Parameters:
| alias (string) | Alias to search for. |
ClearStaleUserObjects
#public void ClearStaleUserObjects()
Remove all user objects that no longer point to existing files.
CompareProxies
#Compare two object proxies. Names and exposures are taken into account.
Parameters:
| A (IGH_ObjectProxy) | First proxy to compare. |
| B (IGH_ObjectProxy) | Second proxy to compare. |
Returns: -1 if A is valued lower than B, 0 if A and B are considered equal, +1 if A is valued higher than B.
CopyFileToAppropriateFolder
#Copy a GHA or GHUSER file into the appropriate Roaming Application Data folder. Of the file is already in the top-level roaming folder it will not be copied.
DestroyLoadingUI
#public void DestroyLoadingUI()
Destroy the loading UI (the banner and the progress bar).
EmitGraph
#Create a new instance of the IGH_Graph that matches the id. If no proxy can be matched to the id, a null reference will be returned.
Parameters:
| id (Guid) | The graph type id to instantiate |
EmitObject
#Create a new instance of the IGH_DocumentObject that matches the id. If no proxy can be matched to the id, a null reference will be returned.
Parameters:
| id (Guid) | The component type id to instantiate |
EmitObjectIcon
#Get the icon that is associated with the given Object ID.
Parameters:
| id (Guid) | ID to search for. |
Returns: Icon of object or null if object is not defined or if object does not have an icon.
EmitObjectProxy
#Get the proxy that is associated with the given Object ID.
Parameters:
| id (Guid) | ID to search for. |
ExternalFiles
#public static List<GH_ExternalFile> ExternalFiles(bool testGrasshopperCollisions, bool testExternalCollisions)
Get lists of all the external files (GHA, GHUSER and GHCLUSTER) that will be loaded by Grasshopper. Note: this does not equal the files that may already have been loaded, just the files that we'll attempt to load if we were asked to load all plugins now. The list contains no duplicate file paths, but it may contain identical files which won't be filtered until actual loading.
FindAssembly
#Gets the assembly that corresponds to the given library ID.
Parameters:
| libraryId (Guid) | Library ID to search for. |
Returns: The library info, or null if the ID is not registered.
FindAssemblyByObject
#Gets the assembly that corresponds to the given library ID.
Parameters:
| objectId (Guid) | The object ComponentGuid. |
Returns: The library info, or null if the ID is not registered.
FindAssemblyByObject
#Gets the assembly that corresponds to the given library ID.
Parameters:
| object (IGH_DocumentObject) | Object. |
Returns: The library info, or null if the ID is not registered.
FindObjectByName
#public IGH_ObjectProxy FindObjectByName(string name, bool ignoreWhiteSpace, bool ignoreCapitalisation)
Find an object by name. Obsolete and hidden objects are ignored. Only exact matches are included.
Parameters:
| name (string) | Name to search for. Name may be prefixed by Category and Subcategory. |
| ignoreWhiteSpace (bool) | If true, whitespace is ignored during matching. |
| ignoreCapitalisation (bool) | If true, capitalisation is ignored during matching. |
Returns: The proxy that matches the name, or null if no such object could be found.
FindObjects
#public int FindObjects(string[] terms, int maximumResults, ref IGH_ObjectProxy[] results, ref double[] resultWeights)
Searches the list of cached object proxies for objects that might be implied by a search term.
Parameters:
| terms (string[]) | Search terms to use. |
| maximumResults (int) | Maximum number of allowed hits. |
| results (ref IGH_ObjectProxy[]) | |
| resultWeights (ref double[]) |
Returns: A sorted list of search results.
FindObjects
#Find all the objects that are part of a certain library.
Parameters:
| libraryID (Guid) | ID of library to search for. |
Returns: A list of all the objects that are defined in the specified library.
FindUpgrader
#Find the upgrader that can convert from the given target.
Parameters:
| target (Guid) | ComponentID of object to upgrade. |
Returns: Matching upgrader or null if no upgrader is defined.
GetAlias
#Gets the alias display string for a given object.
Parameters:
| target (Guid) | Object id to retrieve aliases for. |
Returns: A parsable display string of aliases.
GetCategoryIcon
#Get the icon for a specific category. If the icon hasn't been defined, this method will return the default icon.
Parameters:
| fullName (string) | Full name of category. |
Returns: The category icon.
GetCategoryShortName
#Get the abbreviation (short name) for a specific category. If the short name hasn't been defined, this method will return the full name instead.
Parameters:
| fullName (string) | Full name of category. |
Returns: The abbreviated name or the full name.
GetCategorySymbolName
#Get the single char representation for a specific category. If the char hasn't been defined, this method will return the first char of the full name instead.
Parameters:
| fullName (string) | Full name of category. |
Returns: The category char.
IsGraphCached
#Tests the graph cache for an existing graph type ID.
Parameters:
| id (Guid) | The ID to test for. |
Returns: True if the ID is cached, false if it aint.
IsObjectCached
#Tests the caches for an existing object type ID.
Parameters:
| id (Guid) | The ID to test for. |
Returns: True if the ID is cached, false if it aint.
IsUpgrader
#Checks to see if at least one upgrader is defined for a collection of objects.
Parameters:
| objs (IEnumerable<IGH_DocumentObject>) |
LoadAliases
#public void LoadAliases()
Load the Alias table from the settings directory. Only use this function if you suspect the alias table settings file has changed due to some external process.
LoadExternalFiles
#obsoleteThis method has been replaced by an overload which takes a single boolean.
Attempt to parse all external files. This includes GHA libraries, GHUSER objects and GHCLUSTER files.
Returns: True on success, false on failure.
LoadExternalFiles
#Attempt to parse all external files. This includes GHA libraries, GHUSER objects and GHCLUSTER files.
Parameters:
| loadOneByOne (bool) | Ask the user prior to loading each file. This helps narrowing down startup crashes. |
Returns: True on success, false on failure.
NewUserObject
#Create a new UserObject and write it to the Grasshopper User Object folder.
Parameters:
| obj (IGH_DocumentObject) | Object to write. |
Returns: True on success, false on failure.
RemoveCachedGraph
#Remove a cache entry from the graph cache. This cannot be undone.
Parameters:
| id (Guid) | The id to remove. |
Returns: True on success, false on failure.
RemoveCachedObject
#Remove a cache entry from the object cache. This cannot be undone.
Parameters:
| id (Guid) | The id to remove. |
Returns: True on success, false on failure.
RemoveCachedObject
#Remove the user object (if any) that loads itself from a specified *.ghuser file.
Parameters:
| userObjectFilePath (string) | File name path of user object proxy. |
Returns: True if an object proxy was removed, false if not.
SaveAliases
#public void SaveAliases()
Save the alias table to the settings directory. Use this function if you change the alias table while ignoring usual channels.
SetAlias
#Sets the aliases for a given target.
UpdateRibbonUI
#public static void UpdateRibbonUI()
Forces an update of the Ribbon control on the Grasshopper main form.