MetaData

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

Constructors

MetaData

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

MetaData

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

Properties

Count

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

Empty

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

TransformableCount

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

Indexers

this[]

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

Methods

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

Add

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

AddRhinoId

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

AddRhinoId

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

AddRhinoId

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

AddRhinoId

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

Compare

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

ContainsName

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

DebugData

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

DebugDataSmall

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

Equals

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

FindCommonData

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

FindCommonData

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

FindCommonData

#
Find all non-conflicting meta data in an indexed array of pears.
public static MetaData FindCommonData(
pears,
indices,
conflicts
)

FindCommonData

#
Find all non-conflicting meta data in an indexed collection.
public static MetaData FindCommonData(
collection,
indices,
conflicts
)

FindCommonData

#
Find all non-conflicting meta data in a twig by index.
public static MetaData FindCommonData(
twig,
indices,
conflicts
)

Get<T>

#
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.
public bool Get<T>(
name,
Name to retrieve.
alternate,
Alternate spelling of meta name.
out T
value
Value will be returned here.
)
True if value was found, false if name is undefined or if the type doesn't match.

Get<T>

#
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.
public bool Get<T>(
name,
Name to retrieve.
out T
value
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

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

GetNamesAndValues

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

Matches

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

Merge

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

Merge

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

Merge

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

Merge

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

Merge

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

Names

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

Names

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

Remove

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

Remove

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

RemovePattern

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

RemoveTransient

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

Rename

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

Store

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

ToString

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

ToString

#
Return a string representing the meta data.
public string ToString(
format
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

#
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.
public MetaData Transform(
deform
Deformation.
)
Deformed data.

Transform

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

TransformableNames

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

Validate

#
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.
public static bool Validate(
data,
Data to validate.
out string[]
reasonsWhyNotValid
Reason why the data is not valid, if any.
)
True if data is valid, false otherwise.

Events

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.
public static event EventHandler<MetaData.MetaDataValidationEventArgs> ValidationRequired

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