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

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

BakeContext

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

Properties

BakeIdentifiers

#
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.
public string[] BakeIdentifiers { get; }

FallbackAttributes

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

MetaPattern

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

ProcessGuid

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

ProcessName

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

TargetDocument

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

TargetFile3dm

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

UserPattern

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

Methods

BakeObject

#
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.
public string[] BakeObject(
pear
)
An array of identifiers of baked values.

BakeTree

#
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.
public string[] BakeTree()
An array of identifiers. These will be Guids for objects, but may be other identifying pointers.

EnsureLayers

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

EnsureLayers

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

FindBakedObjects

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

FindBakedObjects

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

SpecificAttributes

#
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.
public ObjectAttributes SpecificAttributes(
pear
Object with meta data to be baked.
)
Attributes to use for baking.

WithProcess

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