# BakeContext class

Namespace: [Grasshopper2.Bake](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.bake.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public sealed class BakeContext
```

Collates all relevant fields used in baking processes, and provides methods for adding, removing and replacing shapes.

## Constructors

- [BakeContext](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/ctor.md): (2 overloads) Create a new bake context.

## Properties

- [BakeIdentifiers](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/bakeidentifiers.md): 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](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/fallbackattributes.md): Default attributes to use during baking.
- [MetaPattern](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/metapattern.md): Gets the meta data pattern to apply during baking.
- [ProcessGuid](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/processguid.md): Gets the guid associated with this bake process.
- [ProcessName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/processname.md): Gets the name associated with this bake process.
- [TargetDocument](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/targetdocument.md): Gets the target document for this bake context. If not set, the [BakeContext.TargetFile3dm](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/targetfile3dm.md) field will be set instead.
- [TargetFile3dm](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/targetfile3dm.md): Gets the target file for this bake context. If not set, the [BakeContext.TargetDocument](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/targetdocument.md) field will be set instead.
- [UserPattern](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/userpattern.md): Gets the userdata pattern to apply during baking.

## Methods

- [BakeObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/bakeobject.md): 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 [BakeContext.BakeTree(ITree, BakeUpdateMode)](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/baketree.md) method to enable bake replacement behaviour.
- [BakeTree](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/baketree.md): 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.
- [EnsureLayers](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/ensurelayers.md): (2 overloads, static) Ensure that all the layers specified by the values in a tree are present in a document.
- [FindBakedObjects](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/findbakedobjects.md): (2 overloads, static) Find all the objects in a Rhino document which have valid bake data. This method iterates over all object types and all object states.
- [SpecificAttributes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/specificattributes.md): Create the attributes to be used for a specific pear. This is a combination of the [BakeContext.FallbackAttributes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/fallbackattributes.md) stored in this context, modified by the object metadata and the [BakeContext.MetaPattern](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/metapattern.md), and possibly adjusted by the type assistant ITypeAssistant.ModifyBakeAttributes implementation.
- [WithProcess](https://developer.rhino3d.com/api/gh2/type/grasshopper2.bake.bakecontext/withprocess.md): Create a new baking context with a different process name.
