Grasshopper1
ReferencesA set of utility methods for converting Grasshopper 1.0 data and types into Grasshopper 2.0 data and types.
Fields
DoNotAutoMigrate
#If your migrator siphons over all relevant properties from a Grasshopper 1 object and you do not wish for the migration pipeline to set things like UserName, Activity state, Preview state and so on, then add a CustomValue with this key to prevent that automatic logic from running.
DoNotMigratePersistent
#Add a value with this key in the object CustomValues to prevent persistent data from being copied by the automatic migration process.
DoNotMigratePreview
#Add a value with this key in the object CustomValues to prevent the preview state from being automatically assigned.
Grasshopper1InstanceId
#Key for storing Grasshopper 1 instance IDs in the custom values of an object.
Grasshopper1SourceId
#Key for a Grasshopper 1 instance id naming this parameter as the source of that object's outgoing wires.
Grasshopper1TargetId
#Key for a Grasshopper 1 instance id naming this parameter as the target of that object's incoming wires.
Properties
ComponentType
#Gets the type which describes the IGH_Component interface as defined in Grasshopper 1.
DocObjectType
#Gets the type which describes the IGH_DocumentObject interface as defined in Grasshopper 1.
Instance
#Gets the Grasshopper 1.0 interop object, i.e. an instance of GrasshopperPlugin.GrasshopperInterop as exposed via the GetInteropObject() method on the Grasshopper 1.0 plugin object. Invoking this property will cause Grasshopper 1.0 to be loaded if it isn't already. This property will throw if the loading of Grasshopper 1.0 fails.
Methods
CreateAndMigrate
#Create a GH1 object, migrate it to the appropriate GH2 object(s) and position them at the specified location.
Parameters:
| grasshopper1ComponentId (Guid) | |
| centre (PointF) |
CreateAndMigrate
#Create GH1 object(s) from the document xml, migrate it to the appropriate GH2 object(s) and position them at the specified location.
Parameters:
| grasshopper1Xml (string) | |
| centre (PointF) |
CreateDocumentFromXml
#Create a new document wrapper from a Grasshopper 1 xml archive, such as the text which Grasshopper 1 places on the clipboard during a copy operation. Archives with both "Clipboard" and "Definition" root chunks are supported.
Parameters:
| xml (string) |
CreateObject
#Create the default instance of an IGH_DocumentObject, IGH_Component or IGH_Param which matches the given ComponentId.
Parameters:
| grasshopper1ComponentId (Guid) |
CreateObject
#Create a constructed instance of an IGH_DocumentObject, IGH_Component or IGH_Param which matches the given xml.
Parameters:
| grasshopper1ObjectXml (string) |
CreateWrapper
#Create an IGH_Param, IGH_Component or IGH_DocumentObject.
Parameters:
| grasshopper1DocObject (object) |
CreateXml
#Serialize a Grasshopper 1 document object to an xml string.
Parameters:
| docObject (IGH_DocumentObject) |
HarvestThumbnail
#Try and load the embedded thumbnail from a GH1 file. This method is static because it does not require Grasshopper 1 to be loaded first.
Parameters:
| path (string) |
ParameterPersistentData
#Extract the persistent data (if any) from a parameter.
Parameters:
| parameter (IGH_Param) |
ParameterVolatileData
#Extract the volatile data (if any) from a parameter.
Parameters:
| parameter (IGH_Param) |
ReadDataFile
#Convert the contents of a data file into a collection of named trees.
ReadDataFile
#Convert the contents of a data file into a collection of named trees.
WriteDataFile
#Create a Grasshopper 1.0 compliant data file from a set of named trees.