Graphical Elements#

Purpose#

A view’s geometry hides in several places. view.geometries holds the loose edges, points and hatchings; a CompositeEntity – the export of a grouped detail – holds its own geometries and may hold other composites; a hatching draws a border; a balloon frame is a circle; a leader draws its curve. A detection reading view.geometries alone misses whatever the drawing groups.

Measured on condor_LISTES_DETAIL_V1, the same plan drawn twice: the sheet with every detail grouped draws 0 geometries at view level and 283 through its 14 composites; the sheet with 8 of them exploded draws 225 at view level and 75 through the 6 left grouped. The relation graph of a view (DERY-3762) must see the two sheets alike, and this module is what makes them so.

What an element is#

ViewGraphicalElementCollector flattens a view into a list of GraphicalElement, one per drawable: an Edge, a Point or a whole Hatching. An element carries the drawable and element.holder, the entity the walk found it under:

element.holder

What the element is

the View

drawn directly by the view

a CompositeEntity

inside a grouped detail, at any depth

a Hatching

one edge of that hatching’s border

a Frame

part of a symbol’s frame — a balloon’s circle

a Leader

a leader’s curve or extension line

anything else

inside another annotation

element.holder and element.geometry.parent answer almost the same question, and belong to different packages. holder is this package’s record of what the walk found the drawable under, written once at collection. parent is dessia_drawing’s own upward link, rewritten every time a holder positions its parts. The two agree for 169 of the 195 elements of the front view shown below; the 26 others are curves this module builds itself – the corners of a simplified hatching border, and the curves of an unpacked chain – new objects no holder ever positioned, whose parent is None.

Read holder, then holder.parent to keep climbing – Edge -> Hatching -> CompositeEntity -> View -> Sheet -> Drawing. A Drawing has no parent attribute at all, so a loop that climbs uses getattr(node, "parent", None).

The descent itself belongs to dessia_drawing: Entity.get_positioned_entities() says what an entity holds and Entity.is_geometry() tells what draws from what only holds. What the module decides is policy, in GraphicalElementConfig:

  • include_composites (default True) – descend into composites, recursively.

  • include_annotation_content (default False) – descend into the other annotations too; off by default, since a frame or a leader is decoration, not part geometry.

  • hatching_border_strategy – simplified (default), raw or none. Some exported borders are tessellated into hundreds of micro-segments: on one section view, 8 hatchings carry 1780 border primitives that simplify to 77 corners. hatching_border_tolerance (default 0.05) is how far the simplified border may stray, an order of magnitude below a coincidence tolerance of 0.5. none leaves the border edges unbuilt, and the hatching stays one element of its own.

  • max_depth (default 8) – deepest nesting walked.

Visualization#

The Graphical Elements selector on FeaturedView redraws every element in the colour of its holder, with a legend counting each. A hatching’s contour is traced once, by its border edges when they were collected and by the hatching itself otherwise, so the strategy chosen above is what the picture actually shows. The colours and their wording live in the overlay’s HOLDER_STYLES, keyed by holder type:

featured_view.graphical_elements                  # the flat list, cached
featured_view.plot_data_graphical_elements().plot()

# reaching annotation decoration too -- a frame's circle, a leader's curve
opened = FeaturedView(view, graphical_element_config=GraphicalElementConfig(include_annotation_content=True))
opened.plot_data_graphical_elements().plot()

The page below, a front view of condor_BEAM_ASSY mixing all six holders, was rendered with include_annotation_content=True so that every holder shows. scripts/generate_plot_data_views.py exports this selector along with every other one, under the default configuration. Arrow heads stay black: an ArrowHead draws its terminator but declares no geometry (dessia_drawing DERY-4083), so no walk can reach its shape – its type stays readable from a leader-curve element through holder.arrow_head.arrow_type.

Source: condor_BEAM_ASSY.json, sheet [1] (VUE DE FACE) — 195 elements