flow360.component.simulation.draft_context.DraftContext#

class DraftContext[source]#

Bases: AbstractContextManager[DraftContext]

Context manager that tracks locally modified simulation entities/status. This should (eventually, not right now) be replacement of accessing entities directly from assets.

property body_groups: EntityRegistryView#

Return the list of body groups in the draft.

Example

>>> with fl.create_draft(new_run_from=geometry) as draft:
...     draft.body_groups["body_group_1"]
...     draft.body_groups["body_group*"]
property surfaces: EntityRegistryView#

Return the list of surfaces in the draft.

property mirrored_body_groups: EntityRegistryView#

Return the list of mirrored body groups in the draft.

Notes

Mirrored entities are draft-only entities derived from mirror actions and stored in the draft registry.

property mirrored_surfaces: EntityRegistryView#

Return the list of mirrored surfaces in the draft.

Notes

Mirrored entities are draft-only entities derived from mirror actions and stored in the draft registry.

property edges: EntityRegistryView#

Return the list of edges in the draft.

property volumes: EntityRegistryView#

Return the list of volumes (volume zones) in the draft.

property boxes: EntityRegistryView#

Return the list of boxes in the draft.

property cylinders: EntityRegistryView#

Return the list of cylinders in the draft.

property imported_geometries: List#

Return the list of imported geometries in the draft.

property imported_surfaces: EntityRegistryView#

Return the list of imported surfaces in the draft.

property coordinate_systems: CoordinateSystemManager#

Coordinate system manager for this draft.

This is the primary user entry point to create/remove coordinate systems, define parent relationships, and assign coordinate systems to draft entities.

See also

CoordinateSystemManager

property mirror: MirrorManager#

Mirror manager for this draft.

This is the primary user entry point to define mirror planes and create/remove mirrored draft-only entities derived from geometry body groups.

See also

MirrorManager

preview_selector(selector, *, return_names=True)[source]#

Preview which entities a selector would match in this draft context.

Parameters:
  • selector (EntitySelector) – The selector to preview (SurfaceSelector, EdgeSelector, VolumeSelector, or BodyGroupSelector).

  • return_names (bool, default True) – When True, returns entity names. When False, returns entity instances.

Returns:

Matched entity names or instances depending on return_names.

Return type:

list[str] or list[EntityBase]

Example

>>> import flow360 as fl
>>> geometry = fl.Geometry.from_cloud(id="...")
>>> with fl.create_draft(new_run_from=geometry) as draft:
...     selector = fl.SurfaceSelector(name="wing_surfaces").match("wing*")
...     matched = draft.preview_selector(selector)
...     print(matched)  # ['wing_upper', 'wing_lower', ...]