drawing_tools package#
Subpackages#
- drawing_tools.config package
- Submodules
- drawing_tools.config.view_language_configs module
- drawing_tools.config.view_types_config module
ViewTypeViewType.BACKGROUND_VIEWViewType.FRONT_VIEWViewType.SECTION_VIEWViewType.ISOMETRIC_VIEWViewType.DETAIL_VIEWViewType.AUXILIARY_VIEWViewType.UNFOLDED_VIEWViewType.EXPLODED_VIEWViewType.LHS_VIEWViewType.RHS_VIEWViewType.BOTTOM_VIEWViewType.REAR_VIEWViewType.TOP_VIEWViewType.LEVELED_SECTION_VIEWViewType.ROTATED_VIEW_ONViewType.TYP_SECTION_VIEWViewType.SECTION_CUTViewType.TYP_SECTION_CUTViewType.__str__()ViewType.all_types()ViewType.get_group()ViewType.__new_member__()
- Module contents
- drawing_tools.constraints package
- Submodules
- drawing_tools.constraints.core module
ConstraintTypeConstraintType.COINCIDENTConstraintType.DISTANCEConstraintType.LENGTHConstraintType.INCIDENCEConstraintType.PARALLELConstraintType.COLLINEARConstraintType.PERPENDICULARConstraintType.ANGULARConstraintType.TANGENTConstraintType.CONCENTRICConstraintType.RADIUSConstraintType.DIAMETERConstraintType.EQUAL_RADIUSConstraintType.EQUAL_LENGTHConstraintType.FIX_POINTConstraintType.HORIZONTALConstraintType.VERTICAL
Constraint
- Module contents
- drawing_tools.helpers package
- Subpackages
- drawing_tools.helpers.dimension package
- drawing_tools.helpers.visualization package
- Production overlays (
overlays/) - drawing_tools.helpers.visualization.overlays.featured module
- drawing_tools.helpers.visualization.overlays.verdict module
- drawing_tools.helpers.visualization.overlays.sheet_sets module
- drawing_tools.helpers.visualization.overlays.detected_table module
- Other modules
- drawing_tools.helpers.visualization.palette module
- drawing_tools.helpers.visualization.edge_constraint_graph module
- Developer diagnostics (
debug/) - drawing_tools.helpers.visualization.debug.sheet_table_detector module
- drawing_tools.helpers.visualization.debug.table_detection_pipeline module
- Module contents
- Production overlays (
- Submodules
- drawing_tools.helpers.geometry module
- Module contents
- Subpackages
- drawing_tools.sheet package
- Submodules
- drawing_tools.sheet.featured_sheet module
FeaturedSheetFeaturedSheet.__init__()FeaturedSheet.__getattr__()FeaturedSheet.formatFeaturedSheet.viewsFeaturedSheet.get_background_view()FeaturedSheet.generate_plot_data_views()FeaturedSheet.views_of_types()FeaturedSheet.views_of_type()FeaturedSheet.views_of_types_by_reading_order()FeaturedSheet.collectorFeaturedSheet.selected_layer_idsFeaturedSheet.plot_data_layers()FeaturedSheet.background_viewFeaturedSheet.front_viewsFeaturedSheet.section_viewsFeaturedSheet.isometric_viewsFeaturedSheet.detail_viewsFeaturedSheet.auxiliary_viewsFeaturedSheet.other_viewsFeaturedSheet.table_detectorFeaturedSheet.set_table_detector()FeaturedSheet.balloonsFeaturedSheet.bonding_symbolsFeaturedSheet.aircraft_reference_linesFeaturedSheet.section_line_indicatorsFeaturedSheet.aircraft_orientation_indicatorsFeaturedSheet.auxiliary_view_indicatorsFeaturedSheet.setsFeaturedSheet.has_setsFeaturedSheet.get_set_for_view()FeaturedSheet.get_views_in_set()FeaturedSheet.views_by_setFeaturedSheet.plot_data_view_indexes()FeaturedSheet.plot_data_grid_reference()FeaturedSheet.plot_data_balloons()FeaturedSheet.plot_data_section_lines()FeaturedSheet.plot_data_arrow_heads()FeaturedSheet.plot_data_leaders()FeaturedSheet.plot_data_line_thicknesses()FeaturedSheet.plot_data_line_types()FeaturedSheet.plot_data_bonding_symbols()FeaturedSheet.plot_data_aircraft_reference_lines()FeaturedSheet.plot_data_aircraft_orientation()FeaturedSheet.plot_data_balloon_flags()FeaturedSheet.plot_data_sets()FeaturedSheet.plot_data_tables()FeaturedSheet.plot_data_title_view()FeaturedSheet.plot_data_auxiliary_view_indicators()FeaturedSheet.plot_data_all_identifiers()FeaturedSheet.plot_data_all_overlays()FeaturedSheet.plot_data_view()FeaturedSheet.report()FeaturedSheet.summary()
- Module contents
FeaturedSheetFeaturedSheet.__init__()FeaturedSheet.__getattr__()FeaturedSheet.formatFeaturedSheet.viewsFeaturedSheet.get_background_view()FeaturedSheet.generate_plot_data_views()FeaturedSheet.views_of_types()FeaturedSheet.views_of_type()FeaturedSheet.views_of_types_by_reading_order()FeaturedSheet.collectorFeaturedSheet.selected_layer_idsFeaturedSheet.plot_data_layers()FeaturedSheet.background_viewFeaturedSheet.front_viewsFeaturedSheet.section_viewsFeaturedSheet.isometric_viewsFeaturedSheet.detail_viewsFeaturedSheet.auxiliary_viewsFeaturedSheet.other_viewsFeaturedSheet.table_detectorFeaturedSheet.set_table_detector()FeaturedSheet.balloonsFeaturedSheet.bonding_symbolsFeaturedSheet.aircraft_reference_linesFeaturedSheet.section_line_indicatorsFeaturedSheet.aircraft_orientation_indicatorsFeaturedSheet.auxiliary_view_indicatorsFeaturedSheet.setsFeaturedSheet.has_setsFeaturedSheet.get_set_for_view()FeaturedSheet.get_views_in_set()FeaturedSheet.views_by_setFeaturedSheet.plot_data_view_indexes()FeaturedSheet.plot_data_grid_reference()FeaturedSheet.plot_data_balloons()FeaturedSheet.plot_data_section_lines()FeaturedSheet.plot_data_arrow_heads()FeaturedSheet.plot_data_leaders()FeaturedSheet.plot_data_line_thicknesses()FeaturedSheet.plot_data_line_types()FeaturedSheet.plot_data_bonding_symbols()FeaturedSheet.plot_data_aircraft_reference_lines()FeaturedSheet.plot_data_aircraft_orientation()FeaturedSheet.plot_data_balloon_flags()FeaturedSheet.plot_data_sets()FeaturedSheet.plot_data_tables()FeaturedSheet.plot_data_title_view()FeaturedSheet.plot_data_auxiliary_view_indicators()FeaturedSheet.plot_data_all_identifiers()FeaturedSheet.plot_data_all_overlays()FeaturedSheet.plot_data_view()FeaturedSheet.report()FeaturedSheet.summary()
- drawing_tools.table package
- Submodules
- drawing_tools.table.candidate_preparation module
- drawing_tools.table.core module
TableLineTableLine.__init__()TableLine.connectionsTableLine.connection_countTableLine.add_connection()TableLine.from_edge()TableLine.virtual()TableLine.startTableLine.endTableLine.is_verticalTableLine.is_horizontalTableLine.line_coordinateTableLine.lengthTableLine.is_virtualTableLine.span_rangesTableLine.merge_with()TableLine.has_gapsTableLine.gap_positionsTableLine.total_coverageTableLine.coverage_ratioTableLine.is_on_range()TableLine.find_connected_component()
TableCellTableCell.__init__()TableCell.is_column_mergedTableCell.is_row_mergedTableCell.column_spanTableCell.row_spanTableCell.widthTableCell.heightTableCell.centerTableCell.areaTableCell.bounding_rectangleTableCell.has_contentTableCell.content_countTableCell.contains_point()TableCell.contains_entity()TableCell.add_content()TableCell.get_text_content()TableCell.get_ordered_content()TableCell.get_combined_text()TableCell.contains_text()TableCell.debug_content_order()TableCell.plot_data_primitives()
GridCellTableGridTableStructure
- drawing_tools.table.detection module
is_symbol_with_rectangle_frame()TableGenerationConfigTableGenerationConfig.toleranceTableGenerationConfig.min_table_sizeTableGenerationConfig.min_cell_sizeTableGenerationConfig.min_edges_for_tableTableGenerationConfig.min_lines_in_componentTableGenerationConfig.intersection_toleranceTableGenerationConfig.min_lines_for_extentTableGenerationConfig.__init__()
DetectedTableDetectedTable.__init__()DetectedTable.horizontal_linesDetectedTable.vertical_linesDetectedTable.gridDetectedTable.boundsDetectedTable.bounding_rectangleDetectedTable.areaDetectedTable.nb_cellsDetectedTable.nb_rowsDetectedTable.nb_colsDetectedTable.total_content_countDetectedTable.non_empty_cellsDetectedTable.get_table_cell_at()DetectedTable.get_grid_cell_at()DetectedTable.get_all_content()DetectedTable.find_table_cells_with_text()DetectedTable.plot_data_primitives()DetectedTable.plot_data()
TableGeneratorSheetTableDetectorSheetTableDetector.__init__()SheetTableDetector.tablesSheetTableDetector.detection_dataSheetTableDetector.get_title_block_annotations()SheetTableDetector.get_title_block_table()SheetTableDetector.detect_title_block()SheetTableDetector.detect_view_tables()SheetTableDetector.detect_tables_in_background_view()SheetTableDetector.detect_all_tables()SheetTableDetector.get_tables_summary()SheetTableDetector.collect_overlay_primitives()
- drawing_tools.table.detection_data module
CandidatePreparationSetDataCandidatePreparationSetData.sourceCandidatePreparationSetData.content_geometriesCandidatePreparationSetData.line_segmentsCandidatePreparationSetData.filtered_edgesCandidatePreparationSetData.excluded_edgesCandidatePreparationSetData.connectivity_debug_infoCandidatePreparationSetData.store_filtering_results()CandidatePreparationSetData.__init__()
TableGenerationSetDataCandidatePreparationDataGeneratedTablesDataValidatedTablesDataViewDetectionDataTableSelectionDataTableDetectionData
- drawing_tools.table.title_block module
- drawing_tools.table.utils module
- drawing_tools.table.validation module
- Module contents
SheetTableDetectorSheetTableDetector.__init__()SheetTableDetector.tablesSheetTableDetector.detection_dataSheetTableDetector.get_title_block_annotations()SheetTableDetector.get_title_block_table()SheetTableDetector.detect_title_block()SheetTableDetector.detect_view_tables()SheetTableDetector.detect_tables_in_background_view()SheetTableDetector.detect_all_tables()SheetTableDetector.get_tables_summary()SheetTableDetector.collect_overlay_primitives()
- drawing_tools.view package
- Subpackages
- Submodules
- drawing_tools.view.featured_view module
FeaturedViewFeaturedView.__init__()FeaturedView.__getattr__()FeaturedView.generate_plot_data_views()FeaturedView.main_title_symbolFeaturedView.sheetFeaturedView.titleFeaturedView.typeFeaturedView.type_for_language()FeaturedView.has_type()FeaturedView.has_any_type()FeaturedView.filter_views_of_types()FeaturedView.scaleFeaturedView.has_titleFeaturedView.geometriesFeaturedView.dimensionsFeaturedView.tolerancesFeaturedView.roughnessFeaturedView.notesFeaturedView.section_line_indicatorsFeaturedView.section_line_indicator_countFeaturedView.aircraft_reference_linesFeaturedView.aircraft_reference_line_countFeaturedView.balloonsFeaturedView.balloon_countFeaturedView.bonding_symbolsFeaturedView.bonding_symbol_countFeaturedView.aircraft_orientation_indicatorsFeaturedView.auxiliary_view_indicatorsFeaturedView.others_annotationsFeaturedView.annotation_countFeaturedView.geometry_countFeaturedView.collectorFeaturedView.selected_layer_idsFeaturedView.plot_data_layers()FeaturedView.get_all_annotations()FeaturedView.get_all_text_content()FeaturedView.plot_data_balloons()FeaturedView.plot_data_bonding_symbols()FeaturedView.plot_data_aircraft_orientation()FeaturedView.plot_data_balloon_flags()FeaturedView.plot_data_section_lines()FeaturedView.plot_data_arrow_heads()FeaturedView.plot_data_leaders()FeaturedView.plot_data_line_thicknesses()FeaturedView.plot_data_line_types()FeaturedView.plot_data_aircraft_reference_lines()FeaturedView.plot_data_title_view()FeaturedView.plot_data_auxiliary_view_indicators()FeaturedView.plot_data_all_identifiers()FeaturedView.plot_data_all_overlays()FeaturedView.plot_data_view()FeaturedView.report()FeaturedView.summary()
- drawing_tools.view.graph module
EdgeAdjacencyGraphEdgeAdjacencyGraph.__init__()EdgeAdjacencyGraph.get_connected_components()EdgeAdjacencyGraph.get_adjacent_edges()EdgeAdjacencyGraph.get_degree()EdgeAdjacencyGraph.get_statistics()EdgeAdjacencyGraph.print_summary()EdgeAdjacencyGraph.plot_data()EdgeAdjacencyGraph.plot_components()EdgeAdjacencyGraph.to_networkx()
GeometryDimensionGraph
- drawing_tools.view.title_reader module
ViewNameInfoScaleInfoRepetitionInfoRepetitionInfo.text_lineRepetitionInfo.valueRepetitionInfo.is_emptyRepetitionInfo.detect_repetition_text_line()RepetitionInfo.extract_repetition_text_line_for_language()RepetitionInfo.find_numeric_repetition()RepetitionInfo.find_word_repetition()RepetitionInfo.extract_repetitions_value()RepetitionInfo.from_text_lines()RepetitionInfo.__init__()
ViewTypeInfoTitleParsedResultTitleParsedResult.view_name_by_languageTitleParsedResult.view_type_by_languageTitleParsedResult.identifiers_by_languageTitleParsedResult.scale_by_languageTitleParsedResult.repetition_by_languageTitleParsedResult.additional_text_linesTitleParsedResult.view_name_text_linesTitleParsedResult.scale_text_linesTitleParsedResult.repetition_text_linesTitleParsedResult.__init__()
TitleParserTitleDetectionConfigcount_title_pattern_matches()ViewTitleViewTitle.__init__()ViewTitle.text_linesViewTitle.lines_contentViewTitle.line_countViewTitle.has_multiple_linesViewTitle.detected_languagesViewTitle.parsed_resultViewTitle.view_name_by_languageViewTitle.view_type_by_languageViewTitle.identifiers_by_languageViewTitle.scale_by_languageViewTitle.repetition_by_languageViewTitle.additional_text_linesViewTitle.view_type()ViewTitle.scale()ViewTitle.repetition()ViewTitle.get_raw_text()ViewTitle.report()ViewTitle.summary()ViewTitle.DEFAULT_LABEL_COLORViewTitle.overlay_primitives()ViewTitle.plot_data_view()ViewTitle.__repr__()
- Module contents
Submodules#
drawing_tools.featured_drawing module#
Enhanced drawing module for extracting features from a drawing.
- class drawing_tools.featured_drawing.FeaturedDrawing(drawing: Drawing, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#
Bases:
DessiaObjectAn enhanced representation of a technical drawing with calculated features.
This class enriches a Drawing object with calculated features that are not directly available in the original Drawing object, including featured sheets, organized annotations, and extracted metadata.
- __init__(drawing: Drawing, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)#
Initialize a FeaturedDrawing instance.
- Parameters:
drawing – The source Drawing 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 drawing object.
This allows accessing drawing attributes (passed as name) directly from FeaturedDrawing, e.g., featured_drawing.sheets instead of featured_drawing.drawing.sheets
- property sheets: list[FeaturedSheet]#
Get all featured sheets in the drawing.
- property views: list[FeaturedView]#
Get all featured views in the drawing.
- views_of_types(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]#
Extract views of specified view types from the drawing.
- 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 across all sheets
- views_of_types_by_reading_order(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]#
Get views of specified view types sorted by reading order in the drawing.
- 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, sorted by reading order
- property collector: DrawingCollector#
Get the DrawingCollector for accessing drawing-level collectors.
This property provides access to drawing-level filtering and searching operations, consistent with how Sheet.collector and View.collector work in dessia_drawing.
Example
symbols = featured_drawing.collector.type.symbols(entity_subtypes=[“TypeBalloon”]) dimensions = featured_drawing.collector.type.dimensions() text_results = featured_drawing.collector.text.search(“tolerance”)
- Returns:
DrawingCollector instance for the underlying drawing
- property layer_infos: LayerInfosSet | None#
The drawing’s layer information set (layers and filters).
Wraps
Drawing._layer_registry()so it is accessible as a stable public property regardless of whether the compiled or pure-Python wheel ofdessia_drawingis used. The compiled wheel exposeslayer_infosdirectly on instances, but the pure-Python wheel does not — accessing it via__getattr__delegation would fail there.
- property selected_layer_ids: list[int] | None#
The layer ids selected for layer-based display (delegated to the underlying drawing).
- plot_data_layers(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- generate_plot_data_views(mode: Literal['open', 'save', 'both'] = 'save', directory: str | None = None, only_detected_elements: bool = True) dict[str, Path | None]#
Export the drawing’s plot_data visualizations to standalone HTML files, per sheet.
Views are exported sheet by sheet (filename suffix
_sheet{i}, natural index, empty sheets included), so each file is a single PrimitiveGroup rather than the drawing-level MultiplePlots.- Parameters:
mode –
"save"writes files silently,"open"opens them in the browser,"both"does both.directory – Output directory; when None a timestamped
..._1D_<ns>S_<nv>Vdirectory is created in the current working directory.only_detected_elements – When True (default), skip overlay views identical to the classic 2D view (nothing detected); the classic view is always kept.
- Returns:
Mapping of
"{method_name}_sheet{i}"to written HTML path (None on failure or"open"mode).
- plot_data_view_indexes(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_grid_reference(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_balloons(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_section_lines(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_arrow_heads(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_leaders(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_thicknesses(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_types(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_bonding_symbols(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_reference_lines(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_orientation(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_balloon_flags(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_sets(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_tables(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_title_view(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_auxiliary_view_indicators(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_all_identifiers(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
- plot_data_all_overlays(reference_path: str = '') MultiplePlots#
Specific display tag for PlotData. Add a picture argument.
drawing_tools.functions module#
Functions for drawing tools.
- drawing_tools.functions.remove_sorted_keywords_from_string(string: str, keywords: list[str]) str#
Remove sorted keywords from a string.
- Parameters:
string – The string to process
keywords – List of keywords to remove (sorted by length, longest first)
- Returns:
The string with keywords removed
- drawing_tools.functions.identify_duplicate_in_list(items: list) list#
Identify duplicate items in a list.
- Parameters:
items – List of items to check for duplicates
- Returns:
List containing only the duplicate items
- drawing_tools.functions.get_supposed_letters_list(nb_items: int, forbidden_letters: list[str] | None = None) list[str]#
Get supposed letters list.
- Parameters:
nb_items – Number of items to get
forbidden_letters – List of forbidden letters
- Returns:
List of supposed letters
- drawing_tools.functions.get_supposed_numbers_list(nb_items: int) list[int]#
Get supposed numbers list.
- Parameters:
nb_items – Number of items to get
- Returns:
List of supposed numbers
- drawing_tools.functions.get_forbidden_letters_for_view_types(view_types: list[ViewType]) list[str]#
Get forbidden letters for a list of view types.
/!Does not take into account different forbidden letters for each view type. This function returns a union of all forbidden letters from all provided view types, which means it treats all view types equally. For more precise handling, consider checking forbidden letters per view type individually.
- Parameters:
view_types – List of ViewType enum values
- Returns:
List of forbidden letters (uppercase)
drawing_tools.title_block module#
Title Block Module.
A comprehensive module for defining and managing title blocks in engineering technical drawings. Based on ISO 7200:2004 standard.
- class drawing_tools.title_block.TitleBlock(legal_owner: str, identification_number: str, date_of_issue: str, title: str, page_number: int = 1, part_ids: list[str] | None = None, revision: str | None = None, number_of_pages: int | None = None, material: str | None = None, weight: str | None = None, general_tolerances: str | None = None, surface_roughness: str | None = None, creator: str | None = None, approver: str | None = None, scale: str | None = None, projection_method: str | None = None, drawing_size: str | None = None, status: str | None = None, zone: str | None = None, safety_class: str | None = None, ecr_ecp_eco: str | None = None, protection_standard: str | None = None, parent_table: DetectedTable | None = None, name: str = '')#
Bases:
DessiaObjectMain title block container following ISO 7200:2004.
- __init__(legal_owner: str, identification_number: str, date_of_issue: str, title: str, page_number: int = 1, part_ids: list[str] | None = None, revision: str | None = None, number_of_pages: int | None = None, material: str | None = None, weight: str | None = None, general_tolerances: str | None = None, surface_roughness: str | None = None, creator: str | None = None, approver: str | None = None, scale: str | None = None, projection_method: str | None = None, drawing_size: str | None = None, status: str | None = None, zone: str | None = None, safety_class: str | None = None, ecr_ecp_eco: str | None = None, protection_standard: str | None = None, parent_table: DetectedTable | None = None, name: str = '')#
Initialize title block with extracted information.
- Parameters:
legal_owner – The name of the company or individual that owns the drawing’s copyright and content. Corresponds to ISO 7200 field ‘a’.
identification_number – The primary, unique identifier for the drawing, such as a part or drawing number. Corresponds to ISO 7200 field ‘b’.
date_of_issue – The date when this version of the drawing was officially issued or released, preferably in YYYY-MM-DD format. Corresponds to ISO 7200 field ‘f’.
title – The descriptive title of the drawing’s subject. This typically describes the part, assembly, or system shown. Corresponds to ISO 7200 field ‘d’.
page_number – The number of the current sheet. Defaults to 1. Corresponds to ISO 7200 field ‘g’.
part_ids – A list of any additional identification numbers associated with the drawing.
revision – The revision identifier (e.g., ‘A’, ‘B’, ‘1.0’) indicating the version of the drawing. Corresponds to ISO 7200 field ‘c’.
number_of_pages – The total number of sheets in the complete drawing set. Corresponds to ISO 7200 field ‘h’.
material – The material specification for the part shown in the drawing (e.g., ‘EN_10027 - S235JR’).
weight – The mass of the object depicted in the drawing, including units (e.g., ‘0,04 kg’).
general_tolerances – The standard for general tolerances to be applied unless otherwise specified (e.g., ‘ISO 2768-mK’).
surface_roughness – The standard or default requirement for surface texture.
creator – The name of the person who created or drew the drawing. Corresponds to ISO 7200 field ‘e’ (Drawn by).
modified_by – The name of the person who last modified the drawing.
approver – The name of the person who approved the drawing for release.
scale – The primary scale of the drawing (e.g., ‘1:1’, ‘1:2’).
projection_method – The projection method used (e.g., ‘First angle’, ‘Third angle’), often represented by the ISO projection symbol.
drawing_size – The size of the drawing sheet according to ISO 5457 (e.g., ‘A3’, ‘A4’).
status – The current lifecycle status of the drawing (e.g., ‘In work’, ‘Released’, ‘Obsolete’).
zone – A reference to a specific zone on the drawing grid.
safety_class – Any safety classification applicable to the part or drawing.
ecr_ecp_eco – Engineering Change Request/Proposal/Order number associated with this drawing version.
protection_standard – The standard for any protective treatment or coating.
parent_table – A reference to the DetectedTable object from which this title block was extracted.
extraction_timestamp – The ISO-formatted timestamp of when the extraction was performed.
name – An optional name for the TitleBlock instance.
Module contents#
drawing_tools - High-level analysis tools for technical drawings.
This package provides comprehensive technical drawing analysis capabilities, from low-level geometric constraints to high-level semantic information extraction.
- class drawing_tools.Constraint(type: ~drawing_tools.constraints.core.ConstraintType, geometries: list[Geometry | ~volmdlr.core_compiled.Point2D], metadata: dict = <factory>)
Bases:
objectConstraint between primitives.
- type: ConstraintType
- geometries: list[Geometry | Point2D]
- metadata: dict
- property valence: int
DOF removed by this constraint.
- __init__(type: ~drawing_tools.constraints.core.ConstraintType, geometries: list[Geometry | ~volmdlr.core_compiled.Point2D], metadata: dict = <factory>) None
- class drawing_tools.ConstraintType(*values)
Bases:
EnumTypes of constraints.
- COINCIDENT = 1
- DISTANCE = 2
- LENGTH = 3
- INCIDENCE = 4
- PARALLEL = 5
- COLLINEAR = 6
- PERPENDICULAR = 7
- ANGULAR = 8
- TANGENT = 9
- CONCENTRIC = 10
- RADIUS = 11
- DIAMETER = 12
- EQUAL_RADIUS = 13
- EQUAL_LENGTH = 14
- FIX_POINT = 15
- HORIZONTAL = 16
- VERTICAL = 17
- class drawing_tools.DimensionAnalyzer(view: View, tolerance: float = 0.001)
Bases:
objectFluent API for analyzing dimensions within a View context.
This class provides a clean interface for analyzing dimensions using the View’s geometry context without creating tight coupling between Dimension and View.
- __init__(view: View, tolerance: float = 0.001)
Initialize the dimension analyzer with a view context.
- Parameters:
view – The view containing dimensions and geometries
tolerance – Distance tolerance for point-to-edge matching
- analyze_dimension(dimension: Dimension) Constraint | None
Analyze a single dimension and return its constraint.
- Parameters:
dimension – Dimension to analyze
- Returns:
Constraintor None if no relationships found
- get_directly_linked_edges(dimension: Dimension) list[Edge]
Get directly linked edges for a dimension.
- Parameters:
dimension – Dimension to analyze
- Returns:
List of directly linked edges
- get_directly_constrained_edges(dimension: Dimension) list[Edge]
Get directly constrained edges for a dimension.
- Parameters:
dimension – Dimension to analyze
- Returns:
List of directly constrained edges
- analyze_all_dimensions() list[Constraint]
Analyze all dimensions in the view and return their constraints.
- Returns:
List of detected dimension constraints
- get_dimension_geometry_constraint_points(dimension: Dimension) list[volmdlr.Point2D]
Get the actual geometry points that a dimension constrains.
This method finds the real geometry points (not extension line endpoints) that the dimension is constraining, accounting for the typical 1-2mm offset between extension lines and geometry in technical drawings.
- Parameters:
dimension – Dimension to analyze
- Returns:
List of actual geometry constraint points (Point2D objects)
- get_dimension_extension_line_points(dimension: Dimension) list[volmdlr.Point2D]
Get extension line endpoints for a dimension (legacy method).
This returns the extension line endpoints, which may have a small offset from the actual geometry points being constrained.
- Parameters:
dimension – Dimension to analyze
- Returns:
List of extension line endpoints (Point2D objects)
- get_dimension_constraint_points_with_metadata(dimension: Dimension) list
Get constraint points with full metadata for a dimension.
- Parameters:
dimension – Dimension to analyze
- Returns:
List of DimensionConstraintPoint objects
- clear_cache() None
Clear the constraint points processor cache.
Useful for freeing memory or when dimensions have been modified.
- get_cache_stats() dict
Get cache statistics for monitoring.
- Returns:
Dictionary with cache statistics
- class drawing_tools.EdgeAdjacencyGraph(view: View, tolerance: float = 0.001, include_incident: bool = False)
Bases:
objectAdjacency graph where nodes represent edges and edges represent coincident relationships.
This graph captures the connectivity structure of a drawing based on which edges share vertices/extremities (coincident relationships) and optionally incident relationships (where one edge’s endpoint lies on another edge).
- __init__(view: View, tolerance: float = 0.001, include_incident: bool = False)
Initialize the edge adjacency graph from a view.
- Parameters:
view – View containing the edges to analyze
tolerance – Tolerance for geometric comparisons
include_incident – If True, include INCIDENT relationships as edges in the graph (in addition to COINCIDENT relationships)
- get_connected_components() list[set[int]]
Get connected components of the adjacency graph.
- Returns:
List of connected components, each containing edge IDs
- get_adjacent_edges(edge: Edge) list[Edge]
Get edges that are adjacent to the given edge (share vertices).
- Parameters:
edge – Edge to find adjacent edges for
- Returns:
List of adjacent edges
- get_degree(edge: Edge) int
Get the degree (number of adjacent edges) of an edge.
- Parameters:
edge – Edge to get degree for
- Returns:
Degree of the edge
- get_statistics() dict
Get statistics about the adjacency graph.
- Returns:
Statistics including number of nodes, edges, components, etc.
- print_summary() None
Print a summary of the adjacency graph structure.
- plot_data(filepath: str | None = None, show_edge_name: bool = False) None
Plot the adjacency graph using plot_data.
- Parameters:
filepath – Optional file path to save the plot
show_edge_name – Whether to show edge names on the graph
- plot_components(filepath: str | None = None) None
Create a plot_data visualization showing edge geometries colored by connected components.
This method retrieves the actual Edge instances from the view and colors them according to their connected component membership, making it easy to visualize which edges are connected through coincident relationships.
- Parameters:
filepath – Optional file path to save the plot
- to_networkx() Graph
Export the adjacency graph as a NetworkX graph.
- Returns:
The adjacency graph with visualization attributes
- class drawing_tools.FeaturedDrawing(drawing: Drawing, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)
Bases:
DessiaObjectAn enhanced representation of a technical drawing with calculated features.
This class enriches a Drawing object with calculated features that are not directly available in the original Drawing object, including featured sheets, organized annotations, and extracted metadata.
- __init__(drawing: Drawing, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)
Initialize a FeaturedDrawing instance.
- Parameters:
drawing – The source Drawing 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 drawing object.
This allows accessing drawing attributes (passed as name) directly from FeaturedDrawing, e.g., featured_drawing.sheets instead of featured_drawing.drawing.sheets
- property sheets: list[FeaturedSheet]
Get all featured sheets in the drawing.
- property views: list[FeaturedView]
Get all featured views in the drawing.
- views_of_types(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]
Extract views of specified view types from the drawing.
- 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 across all sheets
- views_of_types_by_reading_order(view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]
Get views of specified view types sorted by reading order in the drawing.
- 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, sorted by reading order
- property collector: DrawingCollector
Get the DrawingCollector for accessing drawing-level collectors.
This property provides access to drawing-level filtering and searching operations, consistent with how Sheet.collector and View.collector work in dessia_drawing.
Example
symbols = featured_drawing.collector.type.symbols(entity_subtypes=[“TypeBalloon”]) dimensions = featured_drawing.collector.type.dimensions() text_results = featured_drawing.collector.text.search(“tolerance”)
- Returns:
DrawingCollector instance for the underlying drawing
- property layer_infos: LayerInfosSet | None
The drawing’s layer information set (layers and filters).
Wraps
Drawing._layer_registry()so it is accessible as a stable public property regardless of whether the compiled or pure-Python wheel ofdessia_drawingis used. The compiled wheel exposeslayer_infosdirectly on instances, but the pure-Python wheel does not — accessing it via__getattr__delegation would fail there.
- property selected_layer_ids: list[int] | None
The layer ids selected for layer-based display (delegated to the underlying drawing).
- plot_data_layers(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- generate_plot_data_views(mode: Literal['open', 'save', 'both'] = 'save', directory: str | None = None, only_detected_elements: bool = True) dict[str, Path | None]
Export the drawing’s plot_data visualizations to standalone HTML files, per sheet.
Views are exported sheet by sheet (filename suffix
_sheet{i}, natural index, empty sheets included), so each file is a single PrimitiveGroup rather than the drawing-level MultiplePlots.- Parameters:
mode –
"save"writes files silently,"open"opens them in the browser,"both"does both.directory – Output directory; when None a timestamped
..._1D_<ns>S_<nv>Vdirectory is created in the current working directory.only_detected_elements – When True (default), skip overlay views identical to the classic 2D view (nothing detected); the classic view is always kept.
- Returns:
Mapping of
"{method_name}_sheet{i}"to written HTML path (None on failure or"open"mode).
- plot_data_view_indexes(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_grid_reference(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_balloons(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_section_lines(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_arrow_heads(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_leaders(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_thicknesses(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_types(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_bonding_symbols(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_reference_lines(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_orientation(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_balloon_flags(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_sets(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_tables(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_title_view(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_auxiliary_view_indicators(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_all_identifiers(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_all_overlays(reference_path: str = '') MultiplePlots
Specific display tag for PlotData. Add a picture argument.
- plot_data_view(reference_path: str = '') MultiplePlots
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 drawing features.
- class drawing_tools.FeaturedSheet(sheet: Sheet, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)
Bases:
DessiaObjectAn 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>Vdirectory 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 table_detector: SheetTableDetector
The sheet’s table detector — the one given to
set_table_detector(), or default-configured.Shared by
plot_data_tables(), so the rendered overlay always reflects this detector’s configuration (and detection runs once, not once per consumer).A copy or a serialization round-trip re-derives a default-configured detector; call
set_table_detector()again on the result to share a configured one. The detector is derived state, not sheet data, and must stay out of everythingdessia_commonreads — see “Never expose a detector as dessia data” in thedrawing-tools-devskill’sreferences/conventions.md.
- set_table_detector(table_detector: SheetTableDetector) None
Share a pre-built table detector (e.g. one carrying non-default configs) with this sheet.
Replaces any detector already derived, so every later table access and the table overlay both go through table_detector.
- Parameters:
table_detector – The detector every table consumer of this sheet must use.
- Raises:
ValueError – If table_detector was built on a different sheet — its tables and overlays would silently describe that other sheet.
- property bonding_symbols: list[BondingSymbol]
Get all electrical bonding symbols across all views of the sheet.
- property aircraft_reference_lines: list[ReferenceLine]
Get all detected aircraft reference lines of the sheet, across all its views.
- property section_line_indicators: list[SectionLineIndicator]
Get all section line indicators across all views of the sheet.
- property aircraft_orientation_indicators: list[OrientationIndicator]
Get all aircraft orientation 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_ratioand at leastmin_contained_edgesof 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_ratioandmin_contained_edges; views straddling sets are thus attributed to a single set. Full-frame views (e.g. the background view) are excluded by themin_contained_edgesguard rather than by an explicit filter, so they never appear here under the default thresholds.- Parameters:
sheet_set – The SheetSet to query
min_containment_ratio – See
get_set_for_view().min_contained_edges – See
get_set_for_view().
- 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, callget_views_in_set()with an explicitmin_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_arrow_heads(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_leaders(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_thicknesses(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_types(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_bonding_symbols(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_reference_lines(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_orientation(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.
- class drawing_tools.FeaturedView(view: View, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)
Bases:
DessiaObjectAn enhanced representation of a technical drawing view with calculated features.
This class enriches a View object with calculated features that are not directly available in the original View object, including parsed title information, organized annotations, and extracted metadata.
- __init__(view: View, language_configs: list[LanguageConfig] | None = None, title_detection_config: TitleDetectionConfig | None = None)
Initialize a FeaturedView instance.
- Parameters:
view – The source View 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 view object.
This allows accessing view attributes (passed as name) directly from FeaturedView, e.g., featured_view.annotations instead of featured_view.view.annotations
- 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 view’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
..._1Vdirectory 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).
- property main_title_symbol: Entity | None
Find the main title symbol using pattern-based scoring from language configs.
Gets all TypeNote symbols from the view via get_notes(), then scores each by counting pattern matches (view_type) across all configured languages.
Detection parameters (min_patterns, max_text_length) are read from self.title_detection_config.
- property sheet: Sheet
Get the sheet of the view.
- property type: ViewType | None
Get the view type as a ViewType enum (e.g., ViewType.FRONT_VIEW, ViewType.SECTION_VIEW).
- type_for_language(dominant_language: str | None = None) ViewType | None
Get the view type as a ViewType enum for a specific language.
- Parameters:
dominant_language – The language to use for type detection (e.g., “french”, “english”)
- Returns:
The ViewType enum value (e.g., ViewType.FRONT_VIEW, ViewType.SECTION_VIEW), or None if no title
- has_type(view_type: ViewType, dominant_language: str | None = None) bool
Check if the view is of a specific type.
- Parameters:
view_type – The ViewType enum value to check against
dominant_language – The language to use for type detection (e.g., “french”, “english”)
- Returns:
True if the view matches the specified type
- has_any_type(view_types: list[ViewType], dominant_language: str | None = None) bool
Check if the view has a type among the specified types.
- Parameters:
view_types – List of ViewType enum values to check against
dominant_language – The language to use for type detection (e.g., “french”, “english”)
- Returns:
True if the view matches any of the specified types
- static filter_views_of_types(views: list[FeaturedView], view_types: list[ViewType], dominant_language: str | None = None) list[FeaturedView]
Filter views of specified view types.
- Parameters:
views – List of views to filter
view_types – List of view types to filter by
dominant_language – The dominant language to use for filtering
- Returns:
List of views that match the specified types
- property scale: float
Get the numeric scale value from the view.
- property has_title: bool
Check if the view has a title.
- property geometries: list[Edge]
Get current geometries from the view.
- property dimensions: list[Dimension]
Get current dimensions from the view.
- property tolerances: list[GeometricalTolerance]
Get current tolerances from the view.
- property roughness: list[Roughness]
Get roughness annotations.
- property notes: list[Entity]
Get all TypeNote symbols from the view.
- property section_line_indicators: list[SectionLineIndicator]
Get all detected section line indicators in this view.
- property section_line_indicator_count: int
Get the number of section line indicators in this view.
- property aircraft_reference_lines: list[ReferenceLine]
Get all detected aircraft reference lines in this view.
- property aircraft_reference_line_count: int
Get the number of aircraft reference lines in this view.
- property balloon_count: int
Get the number of balloons in this view.
- property bonding_symbols: list[BondingSymbol]
Get all detected electrical bonding symbols in this view.
The detector receives a PROVIDER of the already-analyzed
balloons, not the list itself: it only needs them once a symbol has been detected, so a view holding none never pays for a balloon analysis. And the provider is only wired when this view haslanguage_configs, becauseballoonsreads the title to get the view repetition and the title requires them — bonding detection does not, so without them the detector analyzes the balloons itself rather than making a language-free view fail.
- property bonding_symbol_count: int
Get the number of bonding symbols in this view.
- property aircraft_orientation_indicators: list[OrientationIndicator]
Get all detected aircraft orientation indicators in this view.
The arrow saying where the aircraft’s front is, with what its caption states in each language. The view’s own
language_configsare passed when it has some, so the detected texts are keyed by the same language names as the title; without them the detector falls back to its French and English defaults instead of making a language-free view fail.
- property auxiliary_view_indicators: list[tuple[IdentifierInfo, Entity]]
Detect auxiliary view indicator annotations (renvois de vues auxiliaires).
Returns TypeNotes matching the identifier pattern with letter
"F"and a nearby FillArrow, that are not part of any title or section line indicator. These represent auxiliary view references (e.g.,"F2 2/3","F3"), typically labeled “VUE SUIVANT F…” on the target view.- Returns:
List of (IdentifierInfo, Entity) tuples for each auxiliary view indicator.
- property others_annotations: list[Entity]
Get all the other annotations from the view that aren’t in a specific group.
- property geometry_count: int
Get the number of geometric entities.
- property collector: ViewCollector
Get the ViewCollector for accessing view-level collectors.
This property provides access to view-level filtering and searching operations, consistent with how View.collector works in dessia_drawing.
Example
dimensions = featured_view.collector.annotations.type.dimensions() geometries = featured_view.collector.geometries.type.line_segments() text_results = featured_view.collector.text.search(“tolerance”) top_most = featured_view.collector.extreme.top_most()
- Returns:
ViewCollector instance for the underlying view
- property selected_layer_ids: list[int] | None
The layer ids selected for layer-based display (delegated to the underlying view).
- plot_data_layers(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- get_all_annotations() list[Entity]
Get all annotations combined in a single list.
- plot_data_balloons(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_bonding_symbols(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_orientation(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_section_lines(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_arrow_heads(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_leaders(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_thicknesses(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_line_types(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_aircraft_reference_lines(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- plot_data_title_view(reference_path: str = '', color: str | None = None) 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.
- class drawing_tools.GeometryDimensionGraph(view: View, tolerance: float = 0.001)
Bases:
objectGraph that links all the geometric elements of the drawing with the dimensions.
This graph creates a unified representation where: - Point nodes represent vertices (endpoints, centers) - Edge nodes represent geometric elements (lines, arcs, circles) - Dimension nodes represent dimensional constraints - Incidence edges connect points to their edges - Constraint edges connect dimensions to the geometries they constrain
The graph enables analysis of how dimensions relate to geometric elements and facilitates constraint-based reasoning in technical drawings.
- __init__(view: View, tolerance: float = 0.001)
Initialize the geometry-dimension graph from a view.
- Parameters:
view – View containing the edges and dimensions to analyze
tolerance – Tolerance for geometric comparisons
- plot_data_graph(filepath: str | None = None, show_edge_name: bool = False) None
Plot the geometry-dimension graph using plot_data.
- Parameters:
filepath – Optional file path to save the plot
show_edge_name – Whether to show edge names on the graph
- get_statistics() dict
Get statistics about the geometry-dimension graph.
- Returns:
Dictionary with graph statistics
- print_summary() None
Print a summary of the geometry-dimension graph.
- print_debug_info(verbose: bool = False) None
Print debugging information about geometry matching.
Shows statistics about how many geometries were found by identity vs equality, and details about geometries that couldn’t be matched.
- Parameters:
verbose – If True, print detailed information about each mismatch
- to_networkx() Graph
Export the geometry-dimension graph as a NetworkX graph.
- Returns:
The graph with visualization attributes
- class drawing_tools.OrientationIndicator(source_entity: Entity, arrow_edges: list[Edge], caption_symbol: TextSearchable, text_by_language: dict[str, str])
Bases:
objectWrapper for the arrow and the bilingual caption that say where the aircraft’s front is.
The caption is what carries the meaning – it is read per language, so a check can state what the view says in French and in English – and the arrow is what makes the caption a positioning element rather than a plain note.
- DEFAULT_OVERLAY_COLOR = <plot_data.colors.Color object>
- __init__(source_entity: Entity, arrow_edges: list[Edge], caption_symbol: TextSearchable, text_by_language: dict[str, str]) None
Initialize an indicator from the entity it was detected on.
- Parameters:
source_entity – The entity holding the arrow strokes and the caption – a
CompositeEntityfor the only export shape known so far, hence the loose type: a future detection branch may build indicators from something else.arrow_edges – The graphic edges of that entity, as exported: the arrow strokes. The reference drawings duplicate some of them (10 edges for 8 distinct strokes), which the overlay redraw tolerates.
caption_symbol – The nested text entity carrying the bilingual caption.
text_by_language – Language name (as named by its
LanguageConfig) mapped to the caption line that matched that language, e.g.{"french": "AVANT APPAREIL", "english": "FRONT AIRCRAFT"}.
- __repr__() str
Return a concise representation with the caption and the languages it was read in.
- property text_content: str
The whole caption as exported, every language line joined.
- text_for_language(language_name: str) str | None
Return the caption line recognized for one language, None when that language matched none.
- Parameters:
language_name – The
nameof aLanguageConfig(“french”, “english”…).- Returns:
The matching caption line, or None.
- property overlay_lines: list[str]
what the element is, then what it says per language.
The caption drawn on the sheet and
tooltipboth read these lines, so the two can never diverge.- Type:
The overlay caption lines
- property tooltip: str
overlay_linesjoined, as shown on hover.- Type:
The overlay tooltip
- overlay_primitives(color: Color | None = None) list
Build the diagnostic overlay of this indicator, every part in the same color.
Draws a rectangle around the whole element carrying
tooltip, the arrow strokes redrawn in the overlay color – so the arrow reads at a glance among the view geometry – and theoverlay_linescaption, so what the element says is readable without hovering.- Parameters:
color – Overlay color. Defaults to blue; callers rendering several indicators pass one color per indicator from a palette.
- Returns:
List of plot_data primitives, empty when the element has no bounding rectangle.
- class drawing_tools.ReferenceLine(axis: str, value: float, orientation: Literal['horizontal', 'vertical'], source_entity: Entity, label_entity: Entity, name: str = '')
Bases:
DessiaObjectA dash-dot line positioning the drawn assembly in the aircraft frame.
Pairs the drawn line with the label that gives it its meaning: without the label a dash-dot line is just an axis, so the label is what makes the element.
- DEFAULT_OVERLAY_COLOR = <plot_data.colors.Color object>
- __init__(axis: str, value: float, orientation: Literal['horizontal', 'vertical'], source_entity: Entity, label_entity: Entity, name: str = '')
Initialize an ReferenceLine.
- Parameters:
axis – Aircraft axis the line stands for,
"X","Y"or"Z".value – Value along that axis, as read from the label.
orientation – Orientation of the line on the sheet,
HORIZONTALorVERTICAL.source_entity – The dash-dot entity drawn on the sheet.
label_entity – The text entity naming the axis and the value.
name – Optional display name.
- __repr__() str
Return a concise representation with the axis, the value and the orientation.
- property bounding_rectangle: BoundingRectangle | None
The rectangle covering both the drawn line and its label.
- overlay_primitives(color: str | None = None) list[PlotDataObject]
Build the diagnostic overlay primitives (rectangle plus label lines).
- Parameters:
color – Override color (defaults to blue).
- Returns:
Overlay primitives, empty when the element has no bounding rectangle.
- class drawing_tools.SheetSet(name: str, bounding_rectangle: BoundingRectangle, symbol: Symbol | None = None)
Bases:
objectA named rectangular region within a sheet.
- Parameters:
name – The set identifier (e.g., “000”, “001”)
bounding_rectangle – The rectangular boundary of this set
symbol – The SET marker symbol that identifies this set
- name: str
- bounding_rectangle: BoundingRectangle
- symbol: Symbol | None = None
- contains_point(point: Point2D) bool
Check if a point lies within this set’s bounding rectangle.
- Parameters:
point – The 2D point to check
- Returns:
True if the point is inside the set
- containment_ratio(rectangle: BoundingRectangle) float
Fraction of
rectangle’s area that lies within this set’s bounding rectangle.- Parameters:
rectangle – The rectangle to check
- Returns:
Ratio in [0, 1]; 1.0 when
rectangleis fully contained, 0.0 when disjoint (or whenrectanglehas a null area)
- contained_edge_count(rectangle: BoundingRectangle, tol: float = 1e-06) int
Count how many of
rectangle’s four edges do not overflow this set’s rectangle.A full-frame view (e.g. the background view) overflows the set on all four sides and returns 0, whereas a view that only slightly spills over one or two sides returns 2 or 3.
- Parameters:
rectangle – The rectangle to check
tol – Absolute tolerance for considering an edge non-overflowing
- Returns:
Number of non-overflowing edges, in [0, 4]
- contains_entity(entity: object) bool
Check if an entity’s center lies within this set.
- Parameters:
entity – An entity with a bounding_rectangle property
- Returns:
True if the entity’s center is inside the set
- plot_data_primitives(fill_color: tuple[float, float, float] = (0.6, 0.8, 1.0), opacity: float = 0.15) list[PlotDataObject]
Get plot_data primitives visualizing this set region.
- Parameters:
fill_color – RGB tuple in [0, 1] range for the region fill.
opacity – Fill opacity.
- Returns:
List of plot_data primitives.
- class drawing_tools.SheetTableDetector(sheet: Sheet, candidate_preparation_config: CandidatePreparationConfig | None = None, table_generation_config: TableGenerationConfig | None = None, table_selection_config: TableSelectionConfig | None = None, store_detection_data: bool = False)
Bases:
DessiaObjectDetects and extracts table structures from technical drawing sheets.
- __init__(sheet: Sheet, candidate_preparation_config: CandidatePreparationConfig | None = None, table_generation_config: TableGenerationConfig | None = None, table_selection_config: TableSelectionConfig | None = None, store_detection_data: bool = False)
Initialize the detector with a sheet.
- Parameters:
sheet – The sheet containing tables.
candidate_preparation_config – Configuration for candidate edge preparation (Phase 1)
table_generation_config – Configuration for table structure detection (Phase 2)
table_selection_config – Configuration for table validation and selection (Phase 3)
store_detection_data – If True, store all intermediate pipeline data for visualization/debugging. Access via
detection_dataproperty after detection.
- property tables: dict[int, list[Table | DetectedTable]]
All detected tables (computed once on first access).
- Returns:
Dictionary mapping view index to list of detected tables.
- property detection_data: TableDetectionData
Access stored detection data. Only available when
store_detection_data=True.
- get_title_block_annotations() list[Entity]
Extract annotations that belong to the title block area.
Reads the content-side annotations of the memoized
reference_frame_data. Beyond-content annotations that are not validated grid labels — e.g. the drawing-number continuation strip — are available viareference_frame_data.other_beyond_content_annotationsshould title-block detection ever need to consider them.
- get_title_block_table() DetectedTable | None
Detect the table that represents the title block in the drawing.
Reuses the memoized
tablesso that requesting the title block after (or before) the tables does not run the detection twice.
- detect_title_block() TitleBlock | None
Detect the title block and extract structured information.
- detect_view_tables(view: View, is_background: bool = False, _view_index: int | None = None) list[Table | DetectedTable]
Detect tables in a specific view.
This method finds tables in the view through three independent branches: 1. tables_from_tables — existing Table annotation instances 2. tables_from_notes — Symbol entities (TypeNote) with a rectangular frame 3. tables_from_geometries — edge-based detection from view geometries
- Parameters:
view – The view to search for tables in
is_background – Whether this is the background view (affects detection strategy)
_view_index – Optional view index for storing intermediate data
- Returns:
List of detected table objects (mix of Table annotations and DetectedTable instances)
- detect_tables_in_background_view() list[Table | DetectedTable]
Detect tables specifically in the background view.
This is a convenience method that calls detect_view_tables with the background view and appropriate settings for background view processing.
- Returns:
List of detected table objects in the background view
- detect_all_tables() dict[int, list[Table | DetectedTable]]
Detect all tables in the drawing across all views.
Every view goes through the three branches of
detect_view_tables()(Tableannotations, framedSymbolnotes, edge-based detection).The background view gets ONE extra candidate source: its own
geometries(the sheet frame layer, where the title block and the revision block live), minus the grid reference geometries. For the other views only the geometries carried byCompositeEntityannotations are candidates — their direct geometries draw the part, not tables.Edge-based tables are validated to ensure they have sufficient content before being included.
- Returns:
Dictionary mapping view index to list of validated detected tables
- get_tables_summary(include_validation_stats: bool = False) dict[str, Any]
Get a summary of all detected tables in the drawing.
- Parameters:
include_validation_stats – If True, also include statistics about invalid tables
- Returns:
Dictionary with summary statistics and details
- collect_overlay_primitives() list[PlotDataObject]
Build overlay primitives for all detected tables and the title block.
Thin delegate: the rendering lives with the other table visualizations in
collect_table_overlay_primitives().- Returns:
List of plot_data primitives.
- class drawing_tools.TableCell(row_id: int, col_id: int, start: Point2D, end: Point2D, row_range: tuple[int, int], col_range: tuple[int, int], content: list[Entity] | None = None, name: str = '')
Bases:
DessiaObjectRepresents a logical cell in a detected table with content.
TableCell represents the logical/semantic cells of a table, which may span multiple grid positions when merged. Each TableCell contains the actual content (text, annotations) and represents how the table appears to users.
- Example:
If a table cell spans positions (0,0) to (0,2) in the grid: - get_table_cell_at(0, 0), get_table_cell_at(0, 1), get_table_cell_at(0, 2) all return the same TableCell - This TableCell has row_range=(0,0), col_range=(0,2) and contains all content
- __init__(row_id: int, col_id: int, start: Point2D, end: Point2D, row_range: tuple[int, int], col_range: tuple[int, int], content: list[Entity] | None = None, name: str = '')
Initialize a TableCell.
- Parameters:
row_id – Row index of the first grid position this cell occupies
col_id – Column index of the first grid position this cell occupies
start – Bottom-left corner point of the cell
end – Top-right corner point of the cell
row_range – Tuple of (start_row, end_row) indicating the cell’s row span
col_range – Tuple of (start_col, end_col) indicating the cell’s column span
content – Optional list of Entity objects (text, annotations) contained in this cell
name – Optional name for the cell
- property is_column_merged: bool
Check if this cell spans multiple columns.
- property is_row_merged: bool
Check if this cell spans multiple rows.
- property column_span: int
Number of columns this cell spans.
- property row_span: int
Number of rows this cell spans.
- property width: float
Get the width of the cell.
- property height: float
Get the height of the cell.
- property center: Point2D
Get the center point of the cell.
- property area: float
Get the area of the cell.
- property bounding_rectangle: BoundingRectangle
Convert cell to a BoundingRectangle.
- property has_content: bool
Check if this cell has any content.
- property content_count: int
Get the number of entities in this cell.
- contains_point(point: Point2D) bool
Check if a point is inside this cell.
- contains_entity(entity: Entity) bool
Check if an entity belongs to this cell.
An entity belongs to a cell if its bounding rectangle center is inside the cell’s bounding rectangle.
- Parameters:
entity – The entity to check
- Returns:
True if the entity belongs to this cell
- add_content(entity: Entity) None
Add an entity to this cell’s content.
- Parameters:
entity – The entity to add to the cell
- get_text_content(ordered: bool = True, line_tolerance: float = 2.0) list[str]
Extract text content from all entities in this cell.
- Parameters:
ordered – If True, orders content in reading order (top-to-bottom, left-to-right)
line_tolerance – Tolerance for grouping items on the same line (in drawing units)
- Returns:
List of text strings from text-searchable entities
- get_ordered_content(line_tolerance: float = 2.0) list[Entity]
Get cell content ordered in reading order (top-to-bottom, left-to-right).
Groups entities by line (similar Y coordinate) then sorts each line left-to-right.
- Parameters:
line_tolerance – Tolerance for grouping items on the same line
- Returns:
List of entities ordered for reading
- get_combined_text(ordered: bool = True, separator: str = ' ', line_tolerance: float = 2.0) str
Get all text content combined into a single string.
- Parameters:
ordered – If True, orders content in reading order
separator – Separator between text elements
line_tolerance – Tolerance for grouping items on the same line
- Returns:
Combined text string
- contains_text(text: str, case_sensitive: bool = False, ordered: bool = True) bool
Check if this cell contains the given text.
Searches through the cell’s combined text content and returns True if the specified text is found as a substring.
- Parameters:
text – The text to search for (e.g., “SAFETY CLASS”)
case_sensitive – If True, the search is case-sensitive (default: False)
ordered – If True, orders content in reading order before searching
- Returns:
True if the cell contains the text, False otherwise
- debug_content_order(line_tolerance: float = 2.0) str
Debug method to visualize content ordering.
- Parameters:
line_tolerance – Tolerance for grouping items on the same line
- Returns:
String showing the ordering of content with positions
- plot_data_primitives(opacity: float = 0.4, detailed: bool = False, cell_color: Color | None = None) list[PlotDataObject]
Get the plot data representation of the table cell.
- Parameters:
opacity – The opacity of the cell region.
detailed – If activated, add the cell information label (with the merge ranges when the cell spans several grid positions).
cell_color – When given, unified cell color: text content in this color, background in the same color lightened.
- class drawing_tools.TableLine(edge: Edge | None = None, start: Point2D | None = None, end: Point2D | None = None, tolerance: float = 0.5, span_ranges: list[tuple[float, float]] | None = None, name: str = '')
Bases:
DessiaObjectRepresents a line segment for table detection, either from an Edge or virtual.
This class wraps line segments that are used in table structure detection, providing convenient properties for analyzing table grid patterns. Lines can be either extracted from Edge objects or created as virtual lines to complete table boundaries.
- __init__(edge: Edge | None = None, start: Point2D | None = None, end: Point2D | None = None, tolerance: float = 0.5, span_ranges: list[tuple[float, float]] | None = None, name: str = '')
Initialize either from an Edge or from explicit coordinates.
- Parameters:
edge – Optional Edge object to extract line from
start – Start point (required if edge is None)
end – End point (required if edge is None)
tolerance – Tolerance for line classification (vertical/horizontal detection)
span_ranges – Optional custom span ranges (for merged lines with gaps)
- Raises:
ValueError – If edge is invalid or if start/end are missing when edge is None
- classmethod from_edge(edge: Edge, tolerance: float = 0.001) TableLine
Create TableLine from an Edge object.
- Parameters:
edge – Edge containing a line segment
tolerance – Tolerance for line classification
- Returns:
TableLine instance
- classmethod virtual(start: Point2D, end: Point2D, tolerance: float = 0.001) TableLine
Create a virtual TableLine without an associated Edge.
Virtual lines are used to complete table boundaries when detecting table structures that may have incomplete borders.
- Parameters:
start – Start point of the line
end – End point of the line
tolerance – Tolerance for line classification
- Returns:
TableLine instance marked as virtual
- property start: Point2D
Get the start point of the line segment.
- property end: Point2D
Get the end point of the line segment.
- property is_vertical: bool
Check if the line is vertical within tolerance.
- property is_horizontal: bool
Check if the line is horizontal within tolerance.
- property line_coordinate: float
Get the coordinate value where this line is positioned.
For vertical lines, returns the x-coordinate. For horizontal lines, returns the y-coordinate.
- Returns:
The average coordinate along the line’s perpendicular axis
- property length: float
Get the length of the line segment.
- property is_virtual: bool
Check if this is a virtual line (no associated Edge).
Virtual lines are created to complete table boundaries and don’t correspond to actual geometry in the drawing.
- Returns:
True if this line has no associated Edge object
- merge_with(other: TableLine) TableLine
Merge this line with another parallel line.
- Parameters:
other – Another TableLine that should be parallel to this one
- Returns:
New TableLine representing the merged result
- Raises:
ValueError – If lines are not parallel or compatible
- property has_gaps: bool
Check if this line has gaps (multiple span ranges).
- property gap_positions: list[tuple[float, float]]
Get the positions of gaps in this line.
- Returns:
List of (start, end) positions where gaps exist
- property total_coverage: float
Calculate the total length covered by all spans.
- property coverage_ratio: float
Calculate the ratio of covered length to total possible length.
Useful for determining if a line is mostly continuous or has significant gaps.
- is_on_range(coord: float, tolerance: float = 0.0) bool
Check if a coordinate falls on any span of this line.
- Parameters:
coord – y-coordinate for vertical lines, x-coordinate for horizontal
tolerance – Tolerance to extend span boundaries (handles floating-point imprecision)
- Returns:
True if the coordinate is within any span range
- class drawing_tools.TableStructure(lines: list[TableLine], bounds: BoundingRectangle, tolerance: float = 0.001, name: str = '')
Bases:
DessiaObjectRepresents the reverse-engineered structure of a table.
Contains organized lines, grid information, and methods to detect cells within the structure. Serves as the structural foundation for creating a DetectedTable.
- __init__(lines: list[TableLine], bounds: BoundingRectangle, tolerance: float = 0.001, name: str = '')
Initialize by extracting structure from lines.
- Parameters:
lines – Collection of TableLine objects
bounds – Bounding rectangle of the structure
tolerance – Tolerance for line processing
- property grid: TableGrid
Get the table grid (lazy initialization).
- property is_valid: bool
Check if this structure forms a valid table.
- property nb_rows: int
Get the number of rows (horizontal divisions).
- property nb_cols: int
Get the number of columns (vertical divisions).
- detect_cells(min_cell_size: float = 2.0, annotations: list[Entity] | None = None) list[TableCell]
Detect TableCell objects by analyzing the grid structure and optionally populate with annotations.
- Parameters:
min_cell_size – Minimum dimension for a valid cell
annotations – Optional list of annotations to associate with cells
- Returns:
List of detected TableCell objects with their content
- class drawing_tools.TitleBlock(legal_owner: str, identification_number: str, date_of_issue: str, title: str, page_number: int = 1, part_ids: list[str] | None = None, revision: str | None = None, number_of_pages: int | None = None, material: str | None = None, weight: str | None = None, general_tolerances: str | None = None, surface_roughness: str | None = None, creator: str | None = None, approver: str | None = None, scale: str | None = None, projection_method: str | None = None, drawing_size: str | None = None, status: str | None = None, zone: str | None = None, safety_class: str | None = None, ecr_ecp_eco: str | None = None, protection_standard: str | None = None, parent_table: DetectedTable | None = None, name: str = '')
Bases:
DessiaObjectMain title block container following ISO 7200:2004.
- __init__(legal_owner: str, identification_number: str, date_of_issue: str, title: str, page_number: int = 1, part_ids: list[str] | None = None, revision: str | None = None, number_of_pages: int | None = None, material: str | None = None, weight: str | None = None, general_tolerances: str | None = None, surface_roughness: str | None = None, creator: str | None = None, approver: str | None = None, scale: str | None = None, projection_method: str | None = None, drawing_size: str | None = None, status: str | None = None, zone: str | None = None, safety_class: str | None = None, ecr_ecp_eco: str | None = None, protection_standard: str | None = None, parent_table: DetectedTable | None = None, name: str = '')
Initialize title block with extracted information.
- Parameters:
legal_owner – The name of the company or individual that owns the drawing’s copyright and content. Corresponds to ISO 7200 field ‘a’.
identification_number – The primary, unique identifier for the drawing, such as a part or drawing number. Corresponds to ISO 7200 field ‘b’.
date_of_issue – The date when this version of the drawing was officially issued or released, preferably in YYYY-MM-DD format. Corresponds to ISO 7200 field ‘f’.
title – The descriptive title of the drawing’s subject. This typically describes the part, assembly, or system shown. Corresponds to ISO 7200 field ‘d’.
page_number – The number of the current sheet. Defaults to 1. Corresponds to ISO 7200 field ‘g’.
part_ids – A list of any additional identification numbers associated with the drawing.
revision – The revision identifier (e.g., ‘A’, ‘B’, ‘1.0’) indicating the version of the drawing. Corresponds to ISO 7200 field ‘c’.
number_of_pages – The total number of sheets in the complete drawing set. Corresponds to ISO 7200 field ‘h’.
material – The material specification for the part shown in the drawing (e.g., ‘EN_10027 - S235JR’).
weight – The mass of the object depicted in the drawing, including units (e.g., ‘0,04 kg’).
general_tolerances – The standard for general tolerances to be applied unless otherwise specified (e.g., ‘ISO 2768-mK’).
surface_roughness – The standard or default requirement for surface texture.
creator – The name of the person who created or drew the drawing. Corresponds to ISO 7200 field ‘e’ (Drawn by).
modified_by – The name of the person who last modified the drawing.
approver – The name of the person who approved the drawing for release.
scale – The primary scale of the drawing (e.g., ‘1:1’, ‘1:2’).
projection_method – The projection method used (e.g., ‘First angle’, ‘Third angle’), often represented by the ISO projection symbol.
drawing_size – The size of the drawing sheet according to ISO 5457 (e.g., ‘A3’, ‘A4’).
status – The current lifecycle status of the drawing (e.g., ‘In work’, ‘Released’, ‘Obsolete’).
zone – A reference to a specific zone on the drawing grid.
safety_class – Any safety classification applicable to the part or drawing.
ecr_ecp_eco – Engineering Change Request/Proposal/Order number associated with this drawing version.
protection_standard – The standard for any protective treatment or coating.
parent_table – A reference to the DetectedTable object from which this title block was extracted.
extraction_timestamp – The ISO-formatted timestamp of when the extraction was performed.
name – An optional name for the TitleBlock instance.
- plot_data() None
Generate a plot_data object representing the title block and saves it as a html file.
- class drawing_tools.ViewDimensionAnalysis(view: View, tolerance: float = 0.001)
Bases:
objectView-based dimension analysis for technical drawings.
Provides dimension constraint analysis, edge relationship detection, and geometric constraint extraction within a technical drawing view context.
- __init__(view: View, tolerance: float = 0.001)
Initialize the dimension analysis API with a view context.
- Parameters:
view – The view containing dimensions and geometries
tolerance – Distance tolerance for point-to-edge matching
- property analyzer: DimensionAnalyzer
Get or create the dimension analyzer.
- analyze_dimension(dimension: Dimension) Constraint | None
Analyze a dimension and return its constraint using the view’s geometry context.
- Parameters:
dimension – The dimension to analyze
- Returns:
Constraint or None if no relationships found
- get_dimension_linked_edges(dimension: Dimension) list[Edge]
Get directly linked edges for a dimension using the view’s geometry context.
- Parameters:
dimension – The dimension to analyze
- Returns:
List of directly linked edges
- get_dimension_constrained_edges(dimension: Dimension) list[Edge]
Get directly constrained edges for a dimension using the view’s geometry context.
- Parameters:
dimension – The dimension to analyze
- Returns:
List of directly constrained edges
- analyze_all_dimensions() list[Constraint]
Analyze all dimensions in the view and return their constraints.
- Returns:
List of all detected constraints
- get_dimension_constraint_points(dimension: Dimension) list
Get constraint points for a dimension using the view’s geometry context.
- Parameters:
dimension – The dimension to analyze
- Returns:
List of constraint points
- get_dimension_constraint_points_with_metadata(dimension: Dimension) list
Get constraint points with metadata for a dimension using the view’s geometry context.
- Parameters:
dimension – The dimension to analyze
- Returns:
List of DimensionConstraintPoint objects
- class drawing_tools.ViewTitle(source_entity: Entity, language_configs: list[LanguageConfig], name: str = '')
Bases:
DessiaObjectA comprehensive representation of a view title symbol organized by text lines.
This class analyzes both the structural aspects (texts, styles, positions) and semantic content (view name, scale, repetitions) of title symbols, with methods that work on a line-by-line basis.
- __init__(source_entity: Entity, language_configs: list[LanguageConfig], name: str = '')
Initialize a ViewTitle instance.
- Parameters:
source_entity – The source annotation entity (currently Symbol) that represents the title
language_configs – List of language configurations used for parsing. Each configuration defines patterns and keywords for a specific language.
name – Optional name for the ViewTitle instance
- property text_lines: list[TextLine]
Get the text lines grouped by y-coordinate.
- property line_count: int
Get the number of text lines in the title.
- property has_multiple_lines: bool
Check if the title has multiple text lines.
- property parsed_result: TitleParsedResult
Get parsed semantic information from the title using TitleParser.
- property view_type_by_language: dict[str, ViewTypeInfo]
Get view types organized by language.
- property additional_text_lines: list[TextLine] | None
Get any additional information not categorized elsewhere.
- view_type(dominant_language: str | None = None) ViewType | None
Get unified view type.
If dominant_language is None, the view type is the one identified for all languages. An error is raised if different view types are identified for different languages. If dominant_language is a specific language, the view type is the one identified for that language.
- scale(dominant_language: str | None = None) float | None
Get unified scale value.
If dominant_language is None, the scale value is the one identified for all languages. An error is raised if different scale values are identified for different languages. If dominant_language is a specific language, the scale value is the one identified for that language.
- repetition(dominant_language: str | None = None) int | None
Get unified repetition value.
If dominant_language is None, the repetition value is the one identified for all languages. An error is raised if different repetition values are identified for different languages. If dominant_language is a specific language, the repetition value is the one identified for that language.
- get_raw_text() str
Get all text content as a single string.
- report() str
Implementation of a tag for displays.
- summary() str
Generate a summary of the title. Alias for
report().
- DEFAULT_LABEL_COLOR = <plot_data.colors.Color object>
- overlay_primitives(color: str | None = None) list[PlotDataObject]
Build all title overlay primitives (rectangle + text labels).
- Parameters:
color – Override label color (default: blue).
- Returns:
Combined list of rectangle and text primitives.
- plot_data_view(reference_path: str = '') PrimitiveGroup
Specific display tag for PlotData. Add a picture argument.
- __repr__() str
Return a string representation of the ViewTitle.
- drawing_tools.detect_sets_by_subdivision_lines(sheet: Sheet, min_length_ratio: float = 0.95) list[SheetSet]
Detect sheet sets by recursively partitioning the content zone at subdivision lines.
Algorithm (worklist / guillotine partition):
Get the background view’s content zone, content geometries and SET marker symbols.
Reconstruct full divider lines by merging collinear segments (
fusion_collinear_segment).Start with the whole content zone as the single remaining zone.
For each remaining zone, crop the divider lines to the zone and find those that cross it over at least
min_length_ratioof its width or height (lines_spanning_rectangle); split the zone at the first one and re-queue both halves, else treat the zone as a leaf.A zone with no crossing divider is a leaf: emit one SheetSet per SET symbol it contains.
- Parameters:
sheet – The sheet to analyze
min_length_ratio – Minimum fraction of a zone’s width/height a line must span to subdivide that zone (0.95 = at least 95%)
- Returns:
List of detected SheetSet instances
- drawing_tools.find_set_symbols(sheet: Sheet) list[Symbol]
Find all Symbol annotations with frame.entity_type == “SET”.
- Parameters:
sheet – The sheet to search
- Returns:
List of Symbol objects with SET frame type