MetaData

References
[IoId("00000000-3083-4573-b36e-50803b2b2e3f")] public sealed class MetaData : IStorable
Represents an unbounded collection of meta data.

Constructors

MetaData

#
public MetaData(IReader reader)
Deserialization constructor.
reader (IReader)Reader object.

MetaData

#
public MetaData(params (MetaName name, MetaValue value)[] namesAndValues)
Metadata constructor collection initializer.
namesAndValues (params (MetaName name, MetaValue value)[])

Properties

Count

#
public int Count { get; }
Gets the number of items in this data.

Empty

#
public static MetaData Empty { get; }
Gets empty meta data.

TransformableCount

#
public int TransformableCount { get; }
Gets the number of transformable entries in this meta data.

Indexers

this[]

#
public MetaValue this[MetaName name] { get; }
Gets the entry associated with the given name. We recommend using the type-safe generic Get() method instead.
name (MetaName)Name of entry to retrieve.
The entry at the given name or null if no such entry exists.

Methods

Add

#
public MetaData Add(MetaName name, Angle value)
Add an angle value.
name (MetaName)Name of value.
value (Angle)Value.

Add

#
public MetaData Add(MetaName name, BigInteger value)
Add an unlimited integer value.
name (MetaName)Name of value.
value (BigInteger)Value.

Add

#
public MetaData Add(MetaName name, bool value)
Add a boolean value.
name (MetaName)Name of value.
value (bool)Value.

Add

#
public MetaData Add(MetaName name, byte[] array)
Add a byte array. This method will duplicate the array, as internally it is stored as an ImmutableArray.
name (MetaName)Name of value.
array (byte[])Data.

Add

#
public MetaData Add(MetaName name, Color value)
Add a Color value.
name (MetaName)Name of value.
value (Color)Value.

Add

#
public MetaData Add(MetaName name, Colour value)
Add a Colour value.
name (MetaName)Name of value.
value (Colour)Value.

Add

#
public MetaData Add(MetaName name, DateTime value)
Add a date/time value.
name (MetaName)Name of value.
value (DateTime)Value.

Add

#
public MetaData Add(MetaName name, double value)
Add a double precision floating point value.
name (MetaName)Name of value.
value (double)Value.

Add

#
public MetaData Add(MetaName name, Gradient value)
Add a Gradient value.
name (MetaName)Name of value.
value (Gradient)Value.

Add

#
public MetaData Add(MetaName name, Guid value)
Add a globally unique identifier value.
name (MetaName)Name of value.
value (Guid)Value.

Add

#
public MetaData Add(MetaName name, int value)
Add an integer value.
name (MetaName)Name of value.
value (int)Value.

Add

#
public MetaData Add(MetaName name, Plane value)
Add a Plane value.
name (MetaName)Name of value.
value (Plane)Value.

Add

#
public MetaData Add(MetaName name, Point3d value)
Add a Point3d value.
name (MetaName)Name of value.
value (Point3d)Value.

Add

#
public MetaData Add(MetaName name, string value)
Add a string value.
name (MetaName)Name of value.
value (string)Value.

Add

#
public MetaData Add(MetaName name, TimeSpan value)
Add a timespan value.
name (MetaName)Name of value.
value (TimeSpan)Value.

Add

#
public MetaData Add(MetaName name, Transform value)
Add a Transformation matrix value.
name (MetaName)Name of value.
value (Transform)Value.

Add

#
public MetaData Add(MetaName name, Vector3d value)
Add a Vector3d value.
name (MetaName)Name of value.
value (Vector3d)Value.

AddRhinoId

#
public MetaData AddRhinoId(Guid id, int index, ObjectAttributes attributes)
Add the 'Rhino.Id' to this meta data and harvest all values from attributes userstrings.
id (Guid)
index (int)
attributes (ObjectAttributes)

AddRhinoId

#
public MetaData AddRhinoId(Guid id, int index)
Add a Rhino reference ID to this meta data.
id (Guid)
index (int)

AddRhinoId

#
public MetaData AddRhinoId(Guid id, ObjectAttributes attributes)
Add the 'Rhino.Id' meta data and harvest all values from attributes userstrings.
id (Guid)
attributes (ObjectAttributes)

AddRhinoId

#
public MetaData AddRhinoId(Guid id)
Add a Rhino reference ID to this meta data.
id (Guid)

Compare

#
public static int Compare(MetaData a, MetaData b)
Perform sort comparison on two blobs of meta data.
a (MetaData)
b (MetaData)

ContainsName

#
public bool ContainsName(MetaName name)
Determines whether this data contains an element with the specified name.
name (MetaName)Name to test.
True if the name exists within this data.

DebugData

#
public static MetaData DebugData()
Create a meta data palette containing all supported data types. This is handy for debugging purposes.
Custom data filled with debug entries.

DebugDataSmall

#
public static MetaData DebugDataSmall()
Create a meta data palette containing only system types. This is handy for debugging purposes.
Custom data filled with debug entries.

Equals

#
public static bool Equals(MetaData a, MetaData b)
Compare two meta data values for equality.
a (MetaData)First value.
b (MetaData)Second value.

FindCommonData

#
public static MetaData FindCommonData(IEnumerable<MetaData> stream, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in a collection.
stream (IEnumerable<MetaData>)
conflicts (out IEnumerable<MetaName>)

FindCommonData

#
public static MetaData FindCommonData(IEnumerable<MetaData> stream)
Find all non-conflicting meta data in a collection.
stream (IEnumerable<MetaData>)

FindCommonData

#
public static MetaData FindCommonData(IList<IPear> pears, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in an indexed array of pears.
pears (IList<IPear>)
indices (IEnumerable<int>)
conflicts (out IEnumerable<MetaName>)

FindCommonData

#
public static MetaData FindCommonData(IList<MetaData> collection, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in an indexed collection.
collection (IList<MetaData>)
indices (IEnumerable<int>)
conflicts (out IEnumerable<MetaName>)

FindCommonData

#
public static MetaData FindCommonData(ITwig twig, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in a twig by index.
twig (ITwig)
indices (IEnumerable<int>)
conflicts (out IEnumerable<MetaName>)

Get<T>

#
public bool Get<T>(MetaName name, MetaName alternate, out T value)
Gets the value with the given or alternate name. This overload makes it easier to check for names which may have different spellings, such as Color/Colour, or Neighbor/Neighbour.
name (MetaName)Name to retrieve.
alternate (MetaName)Alternate spelling of meta name.
value (out T)Value will be returned here.
True if value was found, false if name is undefined or if the type doesn't match.

Get<T>

#
public bool Get<T>(MetaName name, out T value)
Gets the value with the given name. If the name is defined but associated with a value type other than T, a widening conversion will be performed if possible.
name (MetaName)Name to retrieve.
value (out T)Value will be returned here.
True if value was found, false if name is undefined or if the type doesn't match.

GetHashCode

#
public override int GetHashCode()

GetNamesAndValues

#
public void GetNamesAndValues(out MetaName[] names, out MetaValue[] values)
Get two string arrays describing both the names and the values.
names (out MetaName[])Names will be returned here.
values (out MetaValue[])Value descriptions will be returned here.

GetNamesAndValues

#
public void GetNamesAndValues(out string[] names, out string[] values)
Get two string arrays describing both the names and the values.
names (out string[])Names will be returned here.
values (out string[])Value descriptions will be returned here.

Matches

#
public bool Matches(params string[] patterns)
Tests whether any of the names matches any of the patterns.
patterns (params string[])Patterns to test against.
True if at least a single name can be matched up to one of the patterns.

Merge

#
public static MetaData Merge(MergeBehaviour behaviour, List<MetaName> conflicts, params MetaData[] metaData)
Merged multiple metas data collections into a single meta data.
behaviour (MergeBehaviour)Merge behaviour.
conflicts (List<MetaName>)If not null, unmerged conflicting names will be appended here.
metaData (params MetaData[])Meta data to merge.
Merged data.

Merge

#
public static MetaData Merge(MergeBehaviour behaviour, params MetaData[] metaData)
Merged multiple metas data collections into a single meta data.
behaviour (MergeBehaviour)Merge behaviour.
metaData (params MetaData[])Dictionaries to merge.
Merged data.

Merge

#
public MetaData Merge(MetaData other, MergeBehaviour mergeBehaviour, out int identicals, out int collisions)
Merge all data from another MetaData instance.
other (MetaData)MetaData to merge from.
mergeBehaviour (MergeBehaviour)Behaviour for colliding names.
identicals (out int)Number of meta data entries that were identical in both this and the other meta collection.
collisions (out int)Number of meta data entries which had the same name but different values.

Merge

#
public MetaData Merge(MetaData other, MergeBehaviour mergeBehaviour, out MetaName[] conflicts)
Merge all data from another MetaData instance.
other (MetaData)MetaData to merge from.
mergeBehaviour (MergeBehaviour)Behaviour for colliding names.
conflicts (out MetaName[])List of conflicting values that couldn't be merged.

Merge

#
public MetaData Merge(MetaData other, MergeBehaviour mergeBehaviour)
Merge all data from another MetaData instance.
other (MetaData)MetaData to merge from.
mergeBehaviour (MergeBehaviour)Behaviour for colliding names.

Names

#
public IEnumerable<MetaName> Names()
Enumerate over all names in this data.

Names

#
public IEnumerable<MetaName> Names(string pattern)
Enumerate over all names in this data that fit a specific pattern.
pattern (string)Wildcard pattern.

Remove

#
public MetaData Remove(params MetaName[] names)
Remove entries with the specified names.
names (params MetaName[])Names to remove.
Modified metadata. This method returns null if the removed entry was the last remaining one.

Remove

#
public MetaData Remove(string name)
Remove the entry with the specified name.
name (string)Name to remove.
True if an entry was removed.

RemovePattern

#
public MetaData RemovePattern(string pattern)
Remove all entries which match the specified wildcard pattern.
pattern (string)Wildcard pattern to test against.
The number of entries removed.

RemoveTransient

#
public MetaData RemoveTransient(bool removeTransient = true, bool removeRhinoId = false, bool removeUserText = false)
Remove all transient values from this metadata.
removeTransient (bool = true)If true, all entries marked as MetaName.IsTransient are removed.
removeRhinoId (bool = false)If true, Rhino.Id entries are removed as well.
removeUserText (bool = false)If true, Record.UserText entries are removed as well.

Rename

#
public MetaData Rename(MetaName find, MetaName replace)
Rename one of the entries in this metadata. If there is already an entry with the 'replace' name, it will be overwritten.
find (MetaName)
replace (MetaName)

Store

#
public void Store(IWriter writer)
Serialise this meta data.
writer (IWriter)
Store

ToString

#
public override string ToString()
Returns a string representing the meta data.
A string that represents the current data.
Object.ToString

ToString

#
public string ToString(string format)
Return a string representing the meta data.
format (string)Formatting template. Use '{0}' to insert the meta data count into the format. Use '{1}' to insert comma separated meta data names into the format. Use '{2}' to insert comma separated meta data name-value pairs into the format.
Formatted string.

Transform

#
public MetaData Transform(SpaceMorph deform)
Deform this meta data. Note that this is much less well defined than linear transforms. We'll do the best we can, but sometimes meta data simply cannot be deformed correctly. Only points and planes can be deformed as they have a location in space.
deform (SpaceMorph)Deformation.
Deformed data.

Transform

#
public MetaData Transform(Transform transform)
Transform this meta data.
transform (Transform)Transformation matrix.
Transformed data.

TransformableNames

#
public IEnumerable<MetaName> TransformableNames()
Gets all transformable names. These names represent items which will be affected when this data is transformed using a 4x4 matrix.
Enumeration of all transformable names.

Validate

#
public static bool Validate(MetaData data, out string[] reasonsWhyNotValid)
Validate a bunch of meta data using the currently known rules. Plugins may supply their own rules so the behaviour of this method depends on the state of the loaded plugins. As a result, no action should be taken based on the return value of this method, it is meant purely to provide interface feedback, nothing more.
data (MetaData)Data to validate.
reasonsWhyNotValid (out string[])Reason why the data is not valid, if any.
True if data is valid, false otherwise.

Events

ValidationRequired

#
public static event EventHandler<MetaData.MetaDataValidationEventArgs> ValidationRequired
A static event used for testing meta data validity. Handle this event if you wish to flag warnings when the wrong kind of data or the wrong kind of value is associated with a name you care about.

Operators

OperationResultDescription
MetaData+MetaDataMetaDataMerge two metadata instances. This operator correctly handles null instances. In the case of conflicting entries, the left hand instance wins.
MetaData+(MetaName name, MetaValue value)MetaDataMerge two metadata instances. This operator correctly handles null instances. In the case of conflicting entries, the left hand instance wins.
MetaData-MetaNameMetaData