Skip to content

Framing Intent

A FramingIntent defines a desired aspect ratio and protection percentage. It is referenced by framing decisions across canvases to maintain consistent creative intent.

fdl.FramingIntent(*, id, label='', aspect_ratio, protection=0.0)

Bases: HandleWrapper

FramingIntent facade wrapping a C fdl_framing_intent_t handle.

custom_attrs property

Return all custom attributes as a dictionary.

custom_attrs_count()

Return the number of custom attributes on this object.

from_model(model) classmethod

Create a standalone FramingIntent facade from a Pydantic model.

Note: Creates a temporary backing document. The returned object is self-contained but not attached to any parent FDL document.

get_custom_attr(name)

Get a custom attribute value by name.

Parameters:

Name Type Description Default
name str

Attribute name (without _ prefix).

required

Returns:

Type Description
str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt | None

The attribute value, or None if not found.

has_custom_attr(name)

Check if a custom attribute exists.

Parameters:

Name Type Description Default
name str

Attribute name (without _ prefix).

required

remove_custom_attr(name)

Remove a custom attribute.

Parameters:

Name Type Description Default
name str

Attribute name (without _ prefix).

required

Returns:

Type Description
bool

True if the attribute was removed, False if it was not found.

set_custom_attr(name, value)

Set a custom attribute. Type is inferred from value.

Parameters:

Name Type Description Default
name str

Attribute name (without _ prefix).

required
value str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt

Attribute value (str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt).

required

Raises:

Type Description
TypeError

If value is not str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt.

ValueError

If an attribute with the same name exists with a different type.

to_model()

Convert to a Pydantic FramingIntentModel instance.

Returns a pure-data Pydantic model suitable for serialization, API responses, and interoperability with web frameworks.