drawing_tools.view.annotations package#
Subpackages#
- drawing_tools.view.annotations.aircraft package
- Submodules
- drawing_tools.view.annotations.aircraft.orientation_indicators module
OrientationIndicatorOrientationIndicator.DEFAULT_OVERLAY_COLOROrientationIndicator.__init__()OrientationIndicator.__repr__()OrientationIndicator.text_contentOrientationIndicator.languagesOrientationIndicator.text_for_language()OrientationIndicator.overlay_linesOrientationIndicator.tooltipOrientationIndicator.overlay_primitives()OrientationIndicator.arrow_overlay_primitives()
- drawing_tools.view.annotations.aircraft.view_orientation_detector module
- drawing_tools.view.annotations.aircraft.reference_lines module
ReferenceLineDetectionConfigReferenceLineDetectionConfig.dash_dot_curve_typeReferenceLineDetectionConfig.orientation_toleranceReferenceLineDetectionConfig.max_label_gap_in_font_sizesReferenceLineDetectionConfig.max_label_overhang_in_font_sizesReferenceLineDetectionConfig.default_font_sizeReferenceLineDetectionConfig.label_patternReferenceLineDetectionConfig.__init__()
parse_reference_label()ReferenceLine
- drawing_tools.view.annotations.aircraft.view_reference_line_detector module
- Module contents
OrientationDetectionConfigOrientationIndicatorOrientationIndicator.DEFAULT_OVERLAY_COLOROrientationIndicator.__init__()OrientationIndicator.__repr__()OrientationIndicator.text_contentOrientationIndicator.languagesOrientationIndicator.text_for_language()OrientationIndicator.overlay_linesOrientationIndicator.tooltipOrientationIndicator.overlay_primitives()OrientationIndicator.arrow_overlay_primitives()
ReferenceLineReferenceLineDetectionConfigReferenceLineDetectionConfig.dash_dot_curve_typeReferenceLineDetectionConfig.orientation_toleranceReferenceLineDetectionConfig.max_label_gap_in_font_sizesReferenceLineDetectionConfig.max_label_overhang_in_font_sizesReferenceLineDetectionConfig.default_font_sizeReferenceLineDetectionConfig.label_patternReferenceLineDetectionConfig.__init__()
ViewOrientationDetectorViewReferenceLineDetector
- drawing_tools.view.annotations.symbol.electrical package
- Submodules
- drawing_tools.view.annotations.symbol.electrical.bonding_symbols module
MASTER_GROUP_STATUSESCAPTION_LINE_HEIGHT_RATIOBondingSymbolBondingSymbol.__init__()BondingSymbol.leader_notesBondingSymbol.balloonsBondingSymbol.centerBondingSymbol.radiusBondingSymbol.bounding_rectangleBondingSymbol.labelBondingSymbol.leadersBondingSymbol.leader_countBondingSymbol.balloon_countBondingSymbol.master_balloonBondingSymbol.master_balloon_leader_countBondingSymbol.overlay_linesBondingSymbol.tooltipBondingSymbol.overlay_primitives()BondingSymbol.leader_overlay_primitives()BondingSymbol.__repr__()
- drawing_tools.view.annotations.symbol.electrical.view_bonding_symbol_detector module
COMPOSITE_OPTIONSTYPE_NOTE_OPTIONSBondingSymbolDetectionConfigBondingSymbolDetectionConfig.full_circle_countBondingSymbolDetectionConfig.bar_row_countBondingSymbolDetectionConfig.center_touch_toleranceBondingSymbolDetectionConfig.direction_toleranceBondingSymbolDetectionConfig.bar_row_toleranceBondingSymbolDetectionConfig.max_composite_text_countBondingSymbolDetectionConfig.leader_end_toleranceBondingSymbolDetectionConfig.balloon_attachment_gapBondingSymbolDetectionConfig.__init__()
ViewBondingSymbolDetector
- Module contents
BondingSymbolBondingSymbol.__init__()BondingSymbol.leader_notesBondingSymbol.balloonsBondingSymbol.centerBondingSymbol.radiusBondingSymbol.bounding_rectangleBondingSymbol.labelBondingSymbol.leadersBondingSymbol.leader_countBondingSymbol.balloon_countBondingSymbol.master_balloonBondingSymbol.master_balloon_leader_countBondingSymbol.overlay_linesBondingSymbol.tooltipBondingSymbol.overlay_primitives()BondingSymbol.leader_overlay_primitives()BondingSymbol.__repr__()
BondingSymbolDetectionConfigBondingSymbolDetectionConfig.full_circle_countBondingSymbolDetectionConfig.bar_row_countBondingSymbolDetectionConfig.center_touch_toleranceBondingSymbolDetectionConfig.direction_toleranceBondingSymbolDetectionConfig.bar_row_toleranceBondingSymbolDetectionConfig.max_composite_text_countBondingSymbolDetectionConfig.leader_end_toleranceBondingSymbolDetectionConfig.balloon_attachment_gapBondingSymbolDetectionConfig.__init__()
ViewBondingSymbolDetector
Submodules#
drawing_tools.view.annotations.dimension_analysis module#
View-based dimension analysis API for technical drawings.
- class drawing_tools.view.annotations.dimension_analysis.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
drawing_tools.view.annotations.dimensioning module#
Dimension processors based on dimensions types.
- class drawing_tools.view.annotations.dimensioning.BaseDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
objectBase class for dimension-specific constraint processors.
- __init__(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Initialize the processor.
- Parameters:
dimension – Dimension to process
point_mapper –
PointToEdgeMapperinstance for point-to-edge mappingtolerance – Precision tolerance
distance_tolerance – Distance tolerance
dimension_analyzer – Required DimensionAnalyzer for constraint points
- get_constraint_points() list[Point2D]#
Return all points where the dimension constrains the geometry using smart analysis.
This method returns the actual geometry points that the dimension constrains, accounting for the typical 1-2mm offset between extension lines and geometry.
- Returns:
List of actual geometry constraint points (Point2D objects)
- get_constraint_points_with_metadata() list#
Return constraint points with full metadata.
- Returns:
List of DimensionConstraintPoint objects
- to_constraint() Constraint#
Translate the dimension into a
Constraint.- Returns:
Constraint representing this dimension
- get_directly_constrained_edges() list[Edge]#
Return all direct constrained edges.
A directly constrained edge is an edge has at list on of its degree of freedom that is constrained by the dimension.
- get_directly_linked_edges() list[Edge]#
Return the directly linked edges to the dimension.
A directly linked edge is an edge whose on of it extremities is attached to the dimension by the extension lines. Or one of it features serves as reference to a dimension definition, line the center of a circle for a radius dimension.
- class drawing_tools.view.annotations.dimensioning.LengthDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
BaseDimensionProcessorProcessor for LengthDimension types.
Inherits from
BaseDimensionProcessor.- get_directly_constrained_edges() list[Edge]#
Return all direct constrained edges.
A directly constrained edge is an edge has at list on of its degree of freedom that is constrained by the dimension.
- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.LinearDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
BaseDimensionProcessorProcessor for LinearDimension types.
Inherits from
BaseDimensionProcessor.- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.RadiusDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
BaseDimensionProcessorProcessor for RadiusDimension and LinearRadiusDimension types.
Inherits from
BaseDimensionProcessor.- get_directly_constrained_edges() list[Edge]#
Return all direct constrained edges for radius dimensions.
For radius dimensions, the constrained edge is the arc/circle that matches: 1. The leader arrow points to the center or on the arc 2. The radius matches the dimension value
- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.LinearRadiusDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
BaseDimensionProcessorProcessor for LinearRadiusDimension types (projected cylindrical features).
LinearRadiusDimension applies to line segments that represent the 2D projection of 3D cylindrical features. When a cylinder is viewed from the side, it appears as a rectangle, but the radius dimension still represents the original 3D radius.
Inherits from
BaseDimensionProcessor.- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.LinearDiameterDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
LinearRadiusDimensionProcessorProcessor for LinearDiameterDimension types (projected cylindrical features).
Similar to LinearRadiusDimension but the dimension value represents diameter.
Inherits from
LinearRadiusDimensionProcessor.- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.DiameterDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
RadiusDimensionProcessorProcessor for DiameterDimension and LinearDiameterDimension types.
Inherits from
RadiusDimensionProcessor.- to_constraint() Constraint#
Translate the dimension into a constraint.
- class drawing_tools.view.annotations.dimensioning.AngularDimensionProcessor(dimension: Dimension, point_mapper: PointToEdgeMapper, dimension_analyzer: DimensionAnalyzer, tolerance: float = 0.001, distance_tolerance: float = 2)#
Bases:
BaseDimensionProcessorProcessor for AngularDimension types with direction matching.
Inherits from
BaseDimensionProcessor.- get_directly_constrained_edges() list[Edge]#
Return all direct constrained edges.
A directly constrained edge is an edge has at list on of its degree of freedom that is constrained by the dimension. Uses enriched constraint point metadata for better matching.
- to_constraint() Constraint#
Convert this dimension processor to a constraint.
- class drawing_tools.view.annotations.dimensioning.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
drawing_tools.view.annotations.symbol.balloons module#
Balloon symbol wrapper class.
- class drawing_tools.view.annotations.symbol.balloons.Balloon(symbol: Symbol)#
Bases:
objectWrapper for balloon symbols with group detection capabilities.
- __init__(symbol: Symbol) None#
Initialize with a balloon Symbol.
The grouping analysis fills three attributes afterwards:
group_status(“parent”, “child”, “isolated” or “undefined”),parent_balloon(the parent of a child balloon, None for a parent, an isolated or an undefined one) andgroup_members(every balloon of this one’s group, itself included). Readgroup_membersrather than rebuilding membership fromparent_balloon: an “undefined” group leaves that field None on all of its members, so the walk would collapse each one into a group of its own.- Parameters:
symbol – A dessia_drawing.Symbol — either a genuine balloon (“TypeBalloon”) or a balloon that the drawing mis-classified as a “TypeNote”.
- Raises:
TypeError – If symbol is not a dessia_drawing.Symbol
ValueError – If symbol entity_type is neither “TypeBalloon” nor “TypeNote”
- property type_symbol: str#
Return the underlying symbol’s entity type (“TypeBalloon” or “TypeNote”).
- property leader_count: int#
Return the number of leader arrows directly attached to this balloon.
The leaders and their arrow heads themselves are read straight off the symbol —
balloon.symbol.leadersandballoon.symbol.arrow_heads, from dessia_drawing’sAnnotationLeadersMixin— so this class adds no wrapper of its own for them.
- property diameter: float#
Return the balloon’s diameter.
Uses the bounding rectangle’s x_length (should be approximately y_length for circular balloons). Alternative approaches may be explored if this doesn’t work reliably.
- property center: Point2D#
Return the balloon’s center position.
Uses the center of the frame’s bounding_rectangle.
- property effective_leader_count: int#
Return the effective number of leaders for this balloon.
If parent/isolated: returns own leader count
If child: returns the parent balloon’s leader count
- Raises:
ValueError – If status is “child” but no parent_balloon is set
- overlay_primitives() list#
Build overlay primitives for this balloon.
The balloon frame is highlighted with a color based on group status. Text labels are added below for multiplicators, for-info flags, or repetitions.
- Returns:
List of plot_data primitives.
- flag_overlay_primitives() list#
Build overlay primitives highlighting flag symbols associated with this balloon.
Multiplicator symbols are highlighted in blue, for-info flag symbols in green.
- Returns:
List of plot_data primitives, empty if no flags.
- static legend_primitives(bounding_rectangle: BoundingRectangle) list[pld.PlotDataObject]#
Build legend primitives for balloon group status colors, above the given frame.
- Parameters:
bounding_rectangle – The frame to place the legend above (typically the view’s).
- Returns:
List of plot_data primitives.
Module contents#
The annotation detections of a view, and the detectors that produce them.
Dimensions, balloons, bonding symbols, section line indicators, aircraft reference lines and aircraft orientation indicators.
- class drawing_tools.view.annotations.Balloon(symbol: Symbol)
Bases:
objectWrapper for balloon symbols with group detection capabilities.
- __init__(symbol: Symbol) None
Initialize with a balloon Symbol.
The grouping analysis fills three attributes afterwards:
group_status(“parent”, “child”, “isolated” or “undefined”),parent_balloon(the parent of a child balloon, None for a parent, an isolated or an undefined one) andgroup_members(every balloon of this one’s group, itself included). Readgroup_membersrather than rebuilding membership fromparent_balloon: an “undefined” group leaves that field None on all of its members, so the walk would collapse each one into a group of its own.- Parameters:
symbol – A dessia_drawing.Symbol — either a genuine balloon (“TypeBalloon”) or a balloon that the drawing mis-classified as a “TypeNote”.
- Raises:
TypeError – If symbol is not a dessia_drawing.Symbol
ValueError – If symbol entity_type is neither “TypeBalloon” nor “TypeNote”
- multiplicator_symbol: Symbol | None
- has_for_info_flag: bool
- for_info_flag_symbol: Symbol | None
- property type_symbol: str
Return the underlying symbol’s entity type (“TypeBalloon” or “TypeNote”).
- property text_content: str
Return the balloon’s text (e.g., ‘024’, ‘101’).
- property leader_count: int
Return the number of leader arrows directly attached to this balloon.
The leaders and their arrow heads themselves are read straight off the symbol —
balloon.symbol.leadersandballoon.symbol.arrow_heads, from dessia_drawing’sAnnotationLeadersMixin— so this class adds no wrapper of its own for them.
- property diameter: float
Return the balloon’s diameter.
Uses the bounding rectangle’s x_length (should be approximately y_length for circular balloons). Alternative approaches may be explored if this doesn’t work reliably.
- property radius: float
Return the balloon’s radius (half of diameter).
- property center: Point2D
Return the balloon’s center position.
Uses the center of the frame’s bounding_rectangle.
- property drawing_address: str
Return the balloon’s drawing address from its symbol frame.
- property effective_leader_count: int
Return the effective number of leaders for this balloon.
If parent/isolated: returns own leader count
If child: returns the parent balloon’s leader count
- Raises:
ValueError – If status is “child” but no parent_balloon is set
- overlay_primitives() list
Build overlay primitives for this balloon.
The balloon frame is highlighted with a color based on group status. Text labels are added below for multiplicators, for-info flags, or repetitions.
- Returns:
List of plot_data primitives.
- flag_overlay_primitives() list
Build overlay primitives highlighting flag symbols associated with this balloon.
Multiplicator symbols are highlighted in blue, for-info flag symbols in green.
- Returns:
List of plot_data primitives, empty if no flags.
- static legend_primitives(bounding_rectangle: BoundingRectangle) list[pld.PlotDataObject]
Build legend primitives for balloon group status colors, above the given frame.
- Parameters:
bounding_rectangle – The frame to place the legend above (typically the view’s).
- Returns:
List of plot_data primitives.
- __repr__() str
Return a string representation of the balloon.
- class drawing_tools.view.annotations.BondingSymbol(source_entity: Entity, circle: Edge, label_symbol: TextSearchable | None = None)
Bases:
objectWrapper for a bonding symbol composite: the earth glyph, its label and its leader arrows.
A bonding symbol requires an electrical bonding (metal-to-metal continuity) at the points its leader arrows designate. It is drawn as a circle enclosing the earth glyph, with a number beside it — the bonding TYPE of the title-block METALLISATION table.
- __init__(source_entity: Entity, circle: Edge, label_symbol: TextSearchable | None = None) None
Initialize a bonding symbol from the entity it was detected on.
The detector fills two attributes afterwards, mutually exclusive by convention:
leader_notes, the text-less notes carrying the symbol’s own leader arrows, andballoons, the group it is stacked against (closest balloon first) whose leaders it borrows when it has none of its own.- Parameters:
source_entity – The entity holding the circle, the earth glyph and the label — a
CompositeEntityfor the only export shape known so far, hence the loose type: a future detection branch may build symbols from something else.circle – The full-circle edge of the symbol.
label_symbol – The text entity carrying the label, when the symbol has one.
- Raises:
ValueError – If
circleis not a full circle — every geometric property of the symbol reads it, so the mistake is reported here rather than at the first access.
- property center: Point2D
Return the circle center — where the symbol’s own leader arrows converge.
- property radius: float
Return the circle radius.
- property bounding_rectangle: BoundingRectangle
Return the bounding rectangle of the CIRCLE alone — narrower than the drawn symbol.
Deliberate: it is the box the overlay draws on. The label keeps its own (
label_symbol.bounding_rectangle) and the whole drawn symbol — circle, glyph and label together — issource_entity.bounding_rectangle.
- property label: str
Return the text written NEXT TO the circle (“10”, “47”…), “” when none was found.
The circle itself carries no text: the label is a separate note (
label_symbol). Semantically this text is the bonding TYPE of the title-block bonding table, not an identifier of this symbol: several bonding symbols carry the same one without being related to each other.
- property leaders: list[Leader]
Return the leader arrows of the symbol itself, one per designated bonding point.
Same contract as the section-line indicators’ leaders:
Leaderobjects, whatever entity carried them — here one text-less note per arrow (leader_notes, filled by the detector after the detection).
- property leader_count: int
Return the number of leader arrows the symbol carries ITSELF.
A bonding symbol either carries its own arrows, or is stacked against a balloon group and borrows its leaders — never both, a convention the detector applies when it attaches them. So a count of 0 next to a non-empty
balloonsmeans the arrows are the group’s, and their number ismaster_balloon_leader_count. Read those two rather than deciding for yourself which one takes precedence: the day a drawing shows a symbol legitimately carrying both, the convention changes in one place and every consumer follows.
- property balloon_count: int
Return the number of balloons of the group the symbol is stacked against.
0 both when the symbol stands alone and when it carries its own arrows: a symbol that designates its points itself is never attached to a neighbouring balloon.
- property master_balloon: Balloon | None
Return the balloon carrying the attached group’s leaders, None when there is no single one.
The parent of the group when the symbol touches a child balloon, the touched balloon itself when it is a parent or an isolated balloon.
Noneboth when no balloon is attached and when the group is"undefined"— a group with no leader-carrying balloon, or several, has no single master, and claiming one would invent a fact.
- property master_balloon_leader_count: int
Return the leader count of the master balloon, 0 when there is no master.
Read through
master_balloonso a single place resolves the master.Balloon.effective_leader_countis deliberately not used: it answers the child’s own question and cannot express “this group has no single master”.
- property overlay_lines: list[str]
the label, then what designates its bonding points.
The own-leader count is always stated — reading “Owns 0 leaders” above the group lines is what says the symbol borrows the group’s leaders. The group lines only appear when the symbol is stacked against balloons. The caption drawn on the sheet and
tooltipboth read these lines, so the two can never diverge.- Type:
Return the overlay caption lines
- property tooltip: str
overlay_linesjoined, as shown on hover.- Type:
Return the overlay tooltip
- overlay_primitives(color: Color | None = None) list
Build the diagnostic overlay of this bonding symbol, every part in the same color.
Draws a rectangle around the circle carrying
tooltip, the symbol’s own leader arrows — so it reads at a glance which bonding points the symbol designates — and theoverlay_linescaption, so the assignment is readable without hovering, spaced byCAPTION_LINE_HEIGHT_RATIO.- Parameters:
color – Overlay color. Defaults to blue; callers rendering several symbols pass one color per symbol from a palette.
- Returns:
List of plot_data primitives.
- leader_overlay_primitives(color: Color | None = None) list
Redraw the symbol’s own leader arrows in the overlay color.
- Parameters:
color – Overlay color (default: blue).
- Returns:
List of plot_data primitives, empty when the symbol carries no leader.
- __repr__() str
Return a string representation of the bonding symbol.
- class drawing_tools.view.annotations.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.view.annotations.OrientationDetectionConfig(min_arrow_edge_count: int = 2)
Bases:
objectConfiguration for aircraft orientation indicator detection.
- Parameters:
min_arrow_edge_count – Minimum number of graphic edges the entity must draw for its caption to count as an orientation indicator rather than a plain note. Two is the lowest an arrow head can be drawn with. Measured on the reference drawings: every one of the 16 captions is drawn with 10 edges (8 distinct strokes – a chevron head, a two-line shaft, two connectors and a tail feather), so this bound rejects none of them; what it rejects is a caption with no arrow at all, which the rule does not accept as a positioning element.
- min_arrow_edge_count: int = 2
- class drawing_tools.view.annotations.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.view.annotations.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.view.annotations.ReferenceLineDetectionConfig(dash_dot_curve_type: str = 'DOTTED_DASHED', orientation_tolerance: float = 0.09, max_label_gap_in_font_sizes: float = 1.0, max_label_overhang_in_font_sizes: float = 1.0, default_font_size: float = 5.0, label_pattern: Pattern = re.compile('^\\s*([XYZ])\\s*([+-]?\\d+(?:\\.\\d+)?)\\s*$'))
Bases:
objectConfiguration for aircraft reference line detection.
Every distance is expressed in font sizes of the label being tested, so the detection behaves the same on an A4 detail and on an A0 assembly.
- Parameters:
dash_dot_curve_type –
curve_typean entity must declare to be a reference line candidate.orientation_tolerance – Aperture, as a sine, within which a direction counts as horizontal or vertical. Applied to the lines and to the labels alike; anything further off from both axes is oblique and takes no part. Defaults to the aperture of the helper it is passed to, so the two never disagree.
max_label_gap_in_font_sizes – Maximum distance between a label and its line, measured perpendicular to the line.
max_label_overhang_in_font_sizes – How far past a line’s end a label may sit and still be considered to run along it.
default_font_size – Font size assumed when a label declares none.
label_pattern – Compiled regex a label must match, capturing the axis letter and the value.
- dash_dot_curve_type: str = 'DOTTED_DASHED'
- orientation_tolerance: float = 0.09
- max_label_gap_in_font_sizes: float = 1.0
- max_label_overhang_in_font_sizes: float = 1.0
- default_font_size: float = 5.0
- label_pattern: Pattern = re.compile('^\\s*([XYZ])\\s*([+-]?\\d+(?:\\.\\d+)?)\\s*$')
- __init__(dash_dot_curve_type: str = 'DOTTED_DASHED', orientation_tolerance: float = 0.09, max_label_gap_in_font_sizes: float = 1.0, max_label_overhang_in_font_sizes: float = 1.0, default_font_size: float = 5.0, label_pattern: Pattern = re.compile('^\\s*([XYZ])\\s*([+-]?\\d+(?:\\.\\d+)?)\\s*$')) None
- class drawing_tools.view.annotations.SectionLineIndicator(identifier_info: IdentifierInfo, arrow_locations: list[Point2D], arrow_direction: Vector2D | None = None, source_entities: list[Entity] | None = None, detection_source: str = '', name: str = '')
Bases:
DessiaObjectA detected section line indicator.
Represents the symbol showing where a section/auxiliary cut is made, composed of two arrows with the same letter identifier.
Similar to
DetectedTableindrawing_tools.table.detection, this class aggregates entities from different sources (TypeNote with leaders, CompositeEntity arrows, standalone letter texts) into a single detected object with its own visualization.- DEFAULT_OVERLAY_COLOR = <plot_data.colors.Color object>
- __init__(identifier_info: IdentifierInfo, arrow_locations: list[Point2D], arrow_direction: Vector2D | None = None, source_entities: list[Entity] | None = None, detection_source: str = '', name: str = '')
Initialize a SectionLineIndicator.
- Parameters:
identifier_info – Parsed identifier information (letter, number, cross-reference, etc.).
arrow_locations – Positions of the two arrow tips.
arrow_direction – Shared direction vector of both arrows.
source_entities – The dessia_drawing entities that compose this indicator. For symbols: [TypeNote]. For composites: [CompositeEntity_i, CompositeEntity_j, TypeNote_label_i, TypeNote_label_j].
detection_source – Detection branch that produced this indicator (‘symbols’ or ‘composites’).
name – Optional display name.
- __repr__() str
Return a concise string representation with identifier, xref, and detection source.
- property leaders: list
This indicator’s two leaders, whichever branch detected it.
Symbols branch: the real leaders of the source entities. Composites branch: leaders reconstructed from the hatched triangles, which own no leader in the model. Both branches return
Leader, soarrow_heads— and every overlay or rule built on it — needs no special case.
- property arrow_heads: list
The arrow head of each leader — same contract as
Entity.arrow_heads.
- property has_reconstructed_arrow_heads: bool
Whether this indicator’s arrow heads were reconstructed from geometry, not declared.
- property bounding_rectangle: BoundingRectangle | None
Compute the bounding rectangle encompassing all source entities and arrow tips.
- overlay_primitives(color: str | None = None) list[PlotDataObject]
Build all overlay primitives (rectangle + text labels).
- Parameters:
color – Override color (default: red).
- Returns:
Combined list of rectangle and text primitives.
- class drawing_tools.view.annotations.ViewBondingSymbolDetector(view: View, config: BondingSymbolDetectionConfig | None = None, balloons_provider: Callable[[], list[Balloon]] | None = None)
Bases:
objectDetect electrical bonding symbols in a view.
Pipeline:
Every
CompositeEntityof the view whose geometries contain one full circle and the earth glyph inside it (a vertical segment from the center plus its horizontal bars) becomes a symbol.The label is the single text of that same composite — the CAD grouping is authoritative, so no proximity search is needed (checked on the whole reference drawing: the label is nested in the composite for all of its symbols).
The text-less
TypeNotesymbols whose leader ends on the circle are attached to the symbol as its own leader arrows (BondingSymbol.leader_notes).For a symbol left without any arrow of its own, the balloon group whose circle it is stacked against is attached as
BondingSymbol.balloons— that group’s leaders are the ones it borrows. Steps 3 and 4 are exclusive by convention: at most one is filled.
Usage:
detector = ViewBondingSymbolDetector(view) bonding_symbols = detector.bonding_symbols # cached_property
- __init__(view: View, config: BondingSymbolDetectionConfig | None = None, balloons_provider: Callable[[], list[Balloon]] | None = None) None
Initialize the detector.
- Parameters:
view – A dessia_drawing View object to analyze.
config – Detection parameters. Uses defaults if not provided.
balloons_provider – Returns the view’s already-analyzed balloons, so the Featured layer can share what it computed. A callable rather than the list itself: balloons are only needed once a symbol has been detected, and asking the Featured layer for them costs a full balloon analysis (and, through it, title parsing, which requires language configs). Analyzed here when not provided.
- property bonding_symbols: list[BondingSymbol]
All detected bonding symbols (computed once on first access).
- detect_all() list[BondingSymbol]
Detect this view’s bonding symbols, then attach what each one is assigned.
Steps:
Extract the symbols from the view’s composite entities (the only source known so far).
Attach to each of them the leader arrows ending on its circle.
ONLY for a symbol left without any arrow of its own, attach the balloon group it is stacked against, whose leaders it then borrows.
Making step 3 exclusive of step 2 is a CONVENTION taken here, not a law measured on drawings: none seen so far carries both, and a balloon merely sitting next to a symbol that already designates its own points would be a neighbour rather than a stacking relationship. Should a drawing turn up where a symbol legitimately has both, drop the condition below and let the two coexist.
- Returns:
List of detected BondingSymbol instances.
- class drawing_tools.view.annotations.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.view.annotations.ViewOrientationDetector(view: View, language_configs: list[LanguageConfig] | None = None, config: OrientationDetectionConfig | None = None)
Bases:
objectDetect the aircraft orientation indicators of a view.
Every
CompositeEntityof the view whose nested caption matches the orientation patterns of at least one language configuration, and which draws an arrow, becomes an indicator. The caption lines that matched are kept per language, so a check can report what the view says in French and in English.Usage:
detector = ViewOrientationDetector(view) indicators = detector.indicators # cached_property
- __init__(view: View, language_configs: list[LanguageConfig] | None = None, config: OrientationDetectionConfig | None = None) None
Initialize the detector with a view.
- Parameters:
view – A dessia_drawing View object to analyze.
language_configs – The language configurations whose
aircraft_orientation_patternsthe caption is matched against, and whosenamekeys the detected texts. Defaults to the French and English defaults, so a view with no language configuration still detects rather than failing – unlike the view title, this detection reads one fixed caption per language, not a parsed title.config – Detection parameters. Uses defaults if not provided.
- property indicators: list[OrientationIndicator]
All detected aircraft orientation indicators (computed once on first access).
- detect_all() list[OrientationIndicator]
Detect this view’s aircraft orientation indicators.
- Returns:
List of detected OrientationIndicator instances.
- class drawing_tools.view.annotations.ViewReferenceLineDetector(view: View, config: ReferenceLineDetectionConfig | None = None)
Bases:
objectDetect the aircraft reference lines of a view.
Usage:
detector = ViewReferenceLineDetector(view) reference_lines = detector.reference_lines
- __init__(view: View, config: ReferenceLineDetectionConfig | None = None) None
Initialize the detector with a view.
- Parameters:
view – A dessia_drawing View to analyze.
config – Detection parameters. Uses defaults if not provided.
- property reference_lines: list[ReferenceLine]
All detected aircraft reference lines (computed once on first access).
- detect_all() list[ReferenceLine]
Detect every aircraft reference line of the view.
- Returns:
One
ReferenceLineper dash-dot line claimed by a label.