drawing_tools.sheet package#

Submodules#

drawing_tools.sheet.featured_sheet module#

Enhanced sheet module for extracting features from a sheet.

class drawing_tools.sheet.featured_sheet.FeaturedSheet(sheet: Sheet, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#

Bases: DessiaObject

An enhanced representation of a technical drawing sheet with calculated features.

This class enriches a Sheet object with calculated features that are not directly available in the original Sheet object, including featured views, organized annotations, and extracted metadata.

__init__(sheet: Sheet, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#

Initialize a FeaturedSheet instance.

Parameters:
  • sheet – The source Sheet object to enrich with calculated features

  • language_configs – List of language configurations for parsing view titles.

  • title_detection_config – Configuration for title detection parameters.

__getattr__(name: str)#

Delegate attribute access to the underlying sheet object.

This allows accessing sheet attributes (passed as name) directly from FeaturedSheet, e.g., featured_sheet.views instead of featured_sheet.sheet.views

property format: str#

Get the format of the sheet.

property views: list[FeaturedView]#

Get all featured views in the sheet.

get_background_view() View#

Get the background view of the sheet.

generate_plot_data_views(mode: Literal['open', 'save', 'both'] = 'save', directory: str | None = None, only_detected_elements: bool = True) dict[str, Path | None]#

Export this sheet’s plot_data visualizations to standalone HTML files.

Parameters:
  • mode"save" writes files silently, "open" opens them in the browser, "both" does both.

  • directory – Output directory; when None a timestamped ..._1S_<nv>V directory is created in the current working directory.

  • only_detected_elements – When True (default), skip overlay views with nothing detected (they duplicate the classic 2D view, which is always kept).

Returns:

Mapping of view name to written HTML path (None on failure or "open" mode).

views_of_types(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]#

Get all views of specific types in the sheet.

Parameters:
  • view_types – List of ViewType enum values to filter by

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified types

views_of_type(view_type: ViewType, dominant_language: str | None = None) list[FeaturedView]#

Get all views of a specific type in the sheet.

Parameters:
  • view_type – The ViewType enum value to filter by

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified type

views_of_types_by_reading_order(view_types: list[ViewType], y_tolerance: float = 50.0, dominant_language: str | None = None) list[FeaturedView]#

Get views of specified view types sorted by reading order in the sheet.

Parameters:
  • view_types – List of ViewType enum values to filter by

  • y_tolerance – Y-coordinate tolerance for reading order sorting (default: 50.0)

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified types, sorted by reading order

property collector: SheetCollector#

Get the SheetCollector for accessing sheet-level collectors.

This property provides access to sheet-level filtering and searching operations, consistent with how View.collector works in dessia_drawing.

Example

symbols = featured_sheet.collector.type.symbols(entity_subtypes=[“TypeBalloon”]) views_sorted = featured_sheet.collector.get_views_sorted_by_reading_order() text_results = featured_sheet.collector.text.search(“tolerance”)

Returns:

SheetCollector instance for the underlying sheet

property selected_layer_ids: list[int] | None#

The layer ids selected for layer-based display (delegated to the underlying sheet).

plot_data_layers(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

property background_view: FeaturedView#

Get the background view of the sheet as a FeaturedView.

property front_views: list[FeaturedView]#

Get all front views in the sheet.

property section_views: list[FeaturedView]#

Get all section views in the sheet.

property isometric_views: list[FeaturedView]#

Get all isometric views in the sheet.

property detail_views: list[FeaturedView]#

Get all detail views in the sheet.

property auxiliary_views: list[FeaturedView]#

Get all auxiliary views in the sheet.

property other_views: list[FeaturedView]#

Get all other views in the sheet.

property balloons: list[Balloon]#

Get all balloons across all views of the sheet.

property section_line_indicators: list[SectionLineIndicator]#

Get all section line indicators across all views of the sheet.

property auxiliary_view_indicators: list[tuple[IdentifierInfo, object]]#

Get all auxiliary view indicators across all views of the sheet.

property sets: list[SheetSet]#

Get detected sheet sets (lazy-cached).

Returns:

List of SheetSet instances, empty if no sets detected

property has_sets: bool#

Check if the sheet has detected sets.

Returns:

True if at least one set was detected

get_set_for_view(view: FeaturedView, min_containment_ratio: float = 0.9, min_contained_edges: int = 2) SheetSet | None#

Find which set a view belongs to, based on bounding rectangle containment.

A view is assigned to a set when the fraction of the view’s area lying within that set reaches min_containment_ratio and at least min_contained_edges of the view’s four edges do not overflow the set. When several sets qualify (a view straddling a subdivision line), the set with the largest overlap wins.

Parameters:
  • view – The FeaturedView to locate

  • min_containment_ratio – Minimum fraction of the view’s area that must lie within a set for it to be assigned. Defaults to DEFAULT_MIN_CONTAINMENT_RATIO (0.9) to tolerate views that slightly overflow their set rectangle; pass 1.0 for strict full containment.

  • min_contained_edges – Minimum number of the view’s four edges that must not overflow the set. Defaults to DEFAULT_MIN_CONTAINED_EDGES (2), which rejects full-frame views (e.g. the background view) that overflow on all sides while still covering most of a set.

Returns:

The best-matching SheetSet, or None if no set qualifies

get_views_in_set(sheet_set: SheetSet, min_containment_ratio: float = 0.9, min_contained_edges: int = 2) list[FeaturedView]#

Get all views assigned to a given set.

A view is assigned to the set for which it has the largest overlap satisfying both min_containment_ratio and min_contained_edges; views straddling sets are thus attributed to a single set. Full-frame views (e.g. the background view) are excluded by the min_contained_edges guard rather than by an explicit filter, so they never appear here under the default thresholds.

Parameters:
Returns:

List of FeaturedView instances assigned to the set

property views_by_set: dict[str, list[FeaturedView]]#

Get views organized by set name.

Uses the default DEFAULT_MIN_CONTAINMENT_RATIO; for a different threshold, call get_views_in_set() with an explicit min_containment_ratio.

Returns:

Dictionary mapping set names to lists of FeaturedView instances

plot_data_view_indexes(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_grid_reference(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_balloons(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_section_lines(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_balloon_flags(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_sets(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_tables(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_title_view(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_auxiliary_view_indicators(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_all_identifiers(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_all_overlays(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_view(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

report() str#

Implementation of a tag for displays.

summary() str#

Generate a summary description of the sheet features.

Module contents#

Sheet analysis module.

This module contains analysis capabilities for technical drawing sheets.

class drawing_tools.sheet.FeaturedSheet(sheet: Sheet, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#

Bases: DessiaObject

An enhanced representation of a technical drawing sheet with calculated features.

This class enriches a Sheet object with calculated features that are not directly available in the original Sheet object, including featured views, organized annotations, and extracted metadata.

__init__(sheet: Sheet, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#

Initialize a FeaturedSheet instance.

Parameters:
  • sheet – The source Sheet object to enrich with calculated features

  • language_configs – List of language configurations for parsing view titles.

  • title_detection_config – Configuration for title detection parameters.

__getattr__(name: str)#

Delegate attribute access to the underlying sheet object.

This allows accessing sheet attributes (passed as name) directly from FeaturedSheet, e.g., featured_sheet.views instead of featured_sheet.sheet.views

property format: str#

Get the format of the sheet.

property views: list[FeaturedView]#

Get all featured views in the sheet.

get_background_view() View#

Get the background view of the sheet.

generate_plot_data_views(mode: Literal['open', 'save', 'both'] = 'save', directory: str | None = None, only_detected_elements: bool = True) dict[str, Path | None]#

Export this sheet’s plot_data visualizations to standalone HTML files.

Parameters:
  • mode"save" writes files silently, "open" opens them in the browser, "both" does both.

  • directory – Output directory; when None a timestamped ..._1S_<nv>V directory is created in the current working directory.

  • only_detected_elements – When True (default), skip overlay views with nothing detected (they duplicate the classic 2D view, which is always kept).

Returns:

Mapping of view name to written HTML path (None on failure or "open" mode).

views_of_types(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]#

Get all views of specific types in the sheet.

Parameters:
  • view_types – List of ViewType enum values to filter by

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified types

views_of_type(view_type: ViewType, dominant_language: str | None = None) list[FeaturedView]#

Get all views of a specific type in the sheet.

Parameters:
  • view_type – The ViewType enum value to filter by

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified type

views_of_types_by_reading_order(view_types: list[ViewType], y_tolerance: float = 50.0, dominant_language: str | None = None) list[FeaturedView]#

Get views of specified view types sorted by reading order in the sheet.

Parameters:
  • view_types – List of ViewType enum values to filter by

  • y_tolerance – Y-coordinate tolerance for reading order sorting (default: 50.0)

  • dominant_language – The language to use for type detection (e.g., “french”, “english”)

Returns:

List of FeaturedView instances matching the specified types, sorted by reading order

property collector: SheetCollector#

Get the SheetCollector for accessing sheet-level collectors.

This property provides access to sheet-level filtering and searching operations, consistent with how View.collector works in dessia_drawing.

Example

symbols = featured_sheet.collector.type.symbols(entity_subtypes=[“TypeBalloon”]) views_sorted = featured_sheet.collector.get_views_sorted_by_reading_order() text_results = featured_sheet.collector.text.search(“tolerance”)

Returns:

SheetCollector instance for the underlying sheet

property selected_layer_ids: list[int] | None#

The layer ids selected for layer-based display (delegated to the underlying sheet).

plot_data_layers(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

property background_view: FeaturedView#

Get the background view of the sheet as a FeaturedView.

property front_views: list[FeaturedView]#

Get all front views in the sheet.

property section_views: list[FeaturedView]#

Get all section views in the sheet.

property isometric_views: list[FeaturedView]#

Get all isometric views in the sheet.

property detail_views: list[FeaturedView]#

Get all detail views in the sheet.

property auxiliary_views: list[FeaturedView]#

Get all auxiliary views in the sheet.

property other_views: list[FeaturedView]#

Get all other views in the sheet.

property balloons: list[Balloon]#

Get all balloons across all views of the sheet.

property section_line_indicators: list[SectionLineIndicator]#

Get all section line indicators across all views of the sheet.

property auxiliary_view_indicators: list[tuple[IdentifierInfo, object]]#

Get all auxiliary view indicators across all views of the sheet.

property sets: list[SheetSet]#

Get detected sheet sets (lazy-cached).

Returns:

List of SheetSet instances, empty if no sets detected

property has_sets: bool#

Check if the sheet has detected sets.

Returns:

True if at least one set was detected

get_set_for_view(view: FeaturedView, min_containment_ratio: float = 0.9, min_contained_edges: int = 2) SheetSet | None#

Find which set a view belongs to, based on bounding rectangle containment.

A view is assigned to a set when the fraction of the view’s area lying within that set reaches min_containment_ratio and at least min_contained_edges of the view’s four edges do not overflow the set. When several sets qualify (a view straddling a subdivision line), the set with the largest overlap wins.

Parameters:
  • view – The FeaturedView to locate

  • min_containment_ratio – Minimum fraction of the view’s area that must lie within a set for it to be assigned. Defaults to DEFAULT_MIN_CONTAINMENT_RATIO (0.9) to tolerate views that slightly overflow their set rectangle; pass 1.0 for strict full containment.

  • min_contained_edges – Minimum number of the view’s four edges that must not overflow the set. Defaults to DEFAULT_MIN_CONTAINED_EDGES (2), which rejects full-frame views (e.g. the background view) that overflow on all sides while still covering most of a set.

Returns:

The best-matching SheetSet, or None if no set qualifies

get_views_in_set(sheet_set: SheetSet, min_containment_ratio: float = 0.9, min_contained_edges: int = 2) list[FeaturedView]#

Get all views assigned to a given set.

A view is assigned to the set for which it has the largest overlap satisfying both min_containment_ratio and min_contained_edges; views straddling sets are thus attributed to a single set. Full-frame views (e.g. the background view) are excluded by the min_contained_edges guard rather than by an explicit filter, so they never appear here under the default thresholds.

Parameters:
Returns:

List of FeaturedView instances assigned to the set

property views_by_set: dict[str, list[FeaturedView]]#

Get views organized by set name.

Uses the default DEFAULT_MIN_CONTAINMENT_RATIO; for a different threshold, call get_views_in_set() with an explicit min_containment_ratio.

Returns:

Dictionary mapping set names to lists of FeaturedView instances

plot_data_view_indexes(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_grid_reference(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_balloons(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_section_lines(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_balloon_flags(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_sets(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_tables(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_title_view(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_auxiliary_view_indicators(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_all_identifiers(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_all_overlays(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

plot_data_view(reference_path: str = '') PrimitiveGroup#

Specific display tag for PlotData. Add a picture argument.

report() str#

Implementation of a tag for displays.

summary() str#

Generate a summary description of the sheet features.