BakeContext

References
public sealed class BakeContext
Collates all relevant fields used in baking processes, and provides methods for adding, removing and replacing shapes.

Constructors

BakeContext

#
public BakeContext(string name, Guid id, File3dm file, ObjectAttributes attributes = null, UserPattern user = default(UserPattern), MetaPattern meta = default(MetaPattern))
Create a new bake context.
name (string)Process name for this bake. May be left null.
id (Guid)Process id for this bake. May be left empty.
file (File3dm)3dm file into which to bake the objects.
attributes (ObjectAttributes = null)Default object attributes. Note, if you specify your own here, the data inside the 'userPattern' will *not* be applied.
user (UserPattern = null)User pattern for baking overrides.
meta (MetaPattern = null)Meta data pattern for baking overrides.

BakeContext

#
public BakeContext(string name, Guid id, RhinoDoc document, ObjectAttributes attributes = null, UserPattern user = default(UserPattern), MetaPattern meta = default(MetaPattern))
Create a new bake context.
name (string)Process name for this bake. May be left null.
id (Guid)Process id for this bake. May be left empty.
document (RhinoDoc)Rhino document into which to bake the objects.
attributes (ObjectAttributes = null)Default object attributes. Note, if you specify your own here, the data inside the 'userPattern' will *not* be applied.
user (UserPattern = null)User pattern for baking overrides.
meta (MetaPattern = null)Meta data pattern for baking overrides.

Properties

BakeIdentifiers

#
public string[] BakeIdentifiers { get; }
Iterate over all the identifiers for baked values. If the values were baked as objects into the Rhino document, these will be the object IDs, but they may be other identifying strings such as layer-full-path-names.

FallbackAttributes

#
public ObjectAttributes FallbackAttributes { get; }
Default attributes to use during baking.

MetaPattern

#
public MetaPattern MetaPattern { get; }
Gets the meta data pattern to apply during baking.

ProcessGuid

#
public Guid ProcessGuid { get; }
Gets the guid associated with this bake process.

ProcessName

#
public string ProcessName { get; }
Gets the name associated with this bake process.

TargetDocument

#
public RhinoDoc TargetDocument { get; }
Gets the target document for this bake context. If not set, the TargetFile3dm field will be set instead.

TargetFile3dm

#
public File3dm TargetFile3dm { get; }
Gets the target file for this bake context. If not set, the TargetDocument field will be set instead.

UserPattern

#
public UserPattern UserPattern { get; }
Gets the userdata pattern to apply during baking.

Methods

BakeObject

#
public string[] BakeObject(IPear pear)
Attempt to bake a value. Note that this bakes without a baking key, meaning it is not a suitable method to use as part of a baking pipeline or workflow. Use the BakeTree(ITree, BakeUpdateMode) method to enable bake replacement behaviour.
pear (IPear)
An array of identifiers of baked values.

BakeTree

#
public string[] BakeTree(ITree tree, BakeUpdateMode mode)
Attempt to bake an entire tree of values. This method embeds BakeKeys with all object user dictionaries, meaning it is suitable to be used as part of an automated process. Note that this method does not redraw the viewports, that is the responsibility of the caller.
tree (ITree)
mode (BakeUpdateMode)
An array of identifiers. These will be Guids for objects, but may be other identifying pointers.

EnsureLayers

#
public static void EnsureLayers(ITree tree, File3dm file, ObjectAttributes fallbackAttributes = null, UserPattern user = default(UserPattern), MetaPattern meta = default(MetaPattern))
Ensure that all the layers specified by the values in a tree are present in a document.
tree (ITree)
file (File3dm)
fallbackAttributes (ObjectAttributes = null)
user (UserPattern = null)
meta (MetaPattern = null)

EnsureLayers

#
public static void EnsureLayers(ITree tree, RhinoDoc document, ObjectAttributes fallbackAttributes = null, UserPattern user = default(UserPattern), MetaPattern meta = default(MetaPattern))
Ensure that all the layers specified by the values in a tree are present in a document.
tree (ITree)
document (RhinoDoc)
fallbackAttributes (ObjectAttributes = null)
user (UserPattern = null)
meta (MetaPattern = null)

FindBakedObjects

#
public static IEnumerable<(BakeKey key, File3dmObject obj)> FindBakedObjects(File3dm doc, BakeDataState state = BakeDataState.Valid)
Find all the objects in a Rhino document which have valid bake data. This method iterates over all object types and all object states.
doc (File3dm)Document to iterate over.
state (BakeDataState = BakeDataState.Valid)State filter.
A stream of baked objects.

FindBakedObjects

#
public static IEnumerable<(BakeKey key, RhinoObject obj)> FindBakedObjects(RhinoDoc doc, BakeDataState state = BakeDataState.Valid)
Find all the objects in a Rhino document which have valid bake data. This method iterates over all object types and all object states.
doc (RhinoDoc)Document to iterate over.
state (BakeDataState = BakeDataState.Valid)State filter.
A stream of baked objects.

SpecificAttributes

#
public ObjectAttributes SpecificAttributes(IPear pear)
Create the attributes to be used for a specific pear. This is a combination of the FallbackAttributes stored in this context, modified by the object metadata and the MetaPattern, and possibly adjusted by the type assistant ITypeAssistant.ModifyBakeAttributes implementation.
pear (IPear)Object with meta data to be baked.
Attributes to use for baking.

WithProcess

#
public BakeContext WithProcess(string newProcessName, Guid newProcessGuid)
Create a new baking context with a different process name.
newProcessName (string)
newProcessGuid (Guid)