Draft#
A draft is an isolated, in-memory snapshot of an asset’s entity information. It lets you inspect and modify entities (surfaces, edges, volumes, body groups, etc.) locally without mutating the cloud asset.
Context manager that tracks locally modified simulation entities/status. |
The draft is created using the create_draft() function. It is meant to be used with the with statement to create a context manager.
with fl.create_draft(new_run_from=geometry) as draft:
...
|
Create a local draft context from a cloud asset for your run. |
The draft is responsible primarily for the following:
grouping faces, edges and body groups
keeping track of all the existen entities
managing mirror actions
managing coordinate systems
analyzing geometry through the oriented bounding box
Access properties#
The properties of the DraftContext that store the geometric entities within the draft are listed below.
The entities within those properties can be accessed by name or pattern with the only exception being the imported geometries and surfaces, which can be accessed by index.
Return the list of body groups in the draft. |
|
Return the list of surfaces in the draft. |
|
Return the list of mirrored body groups in the draft. |
|
Return the list of mirrored surfaces in the draft. |
|
Return the list of edges in the draft. |
|
Return the list of volumes (volume zones) in the draft. |
|
Return the list of boxes in the draft. |
|
Return the list of cylinders in the draft. |
|
Return the list of imported geometries in the draft. |
|
Return the list of imported surfaces in the draft. |
Management properties#
Managing mirror actions and coordinate systems is done through the following properties.
Coordinate system manager for this draft. |
|
Mirror manager for this draft. |
Those properties provide access to relevant managers.
Manage coordinate systems, hierarchy, and entity assignments inside a DraftContext. |
|
Manage mirror planes and mirrored draft entities inside a DraftContext. |
Actions and objects registered through those managers can be modified by directly accessing them through the manager objects.
Example: geometric parameter sensitivity study
with draft:
draft.coordinate_systems.assign(
entities=draft.body_groups["body_group_1"],
coordinate_system=fl.CoordinateSystem(
name="body_group_1_translation",
origin=[0, 0, 0] * fl.u.mm,
axis_of_rotation=(0, 0, 1),
angle_of_rotation=0 * fl.u.deg,
scale=(1.0, 1.0, 1.0),
translation=[20, 0, 0] * fl.u.mm
)
)
prj.run_case(...)
draft.coordinate_systems.get_by_name("body_group_1_translation").angle_of_rotation = 5*fl.u.deg
prj.run_case(...)
Important
Mirroring and custom coordinate systems are available only with Geometry AI enabled.
Computing an oriented bounding box#
For drafts created from a Geometry asset, the draft can fit an oriented bounding box (OBB) to a set of surfaces using the underlying tessellation data. The box is aligned with the natural axes of the selected surfaces (via principal component analysis) rather than the global coordinate axes, and is used to estimate the rotation axis, center and radius of cylindrical components such as wheels. Those estimates can then drive a rotating wall boundary condition or a rotating reference frame.
|
Compute oriented bounding box for the given surface entities. |
An optional rotation_axis_hint biases the axis selection toward a known
direction. When it is omitted, the axis whose perpendicular cross-section is
most circular is chosen automatically. The result is returned as an
OBBResult exposing center, axes, extents, axis_of_rotation
and radius:
Oriented Bounding Box computed from a point cloud. |
Note
compute_obb requires a draft created from a Geometry resource. Drafts
created from a surface mesh or volume mesh do not carry the tessellation
data the bounding box is computed from.
See also
Estimate a wheel rotation axis with an OBB (runnable snippet using
compute_obb)Asset Drafts user guide (conceptual overview of drafts and geometry analysis)