# fabricesalvaire/patro architecture

> Architecture diagram of the GitHub repository fabricesalvaire/patro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fabricesalvaire/patro
- Repository: https://github.com/fabricesalvaire/patro

## Overview

Patro is a Python library for fashion pattern drafting. Its principal workflow is to define measurements and sketch operations, calculate dependent values, represent the result with geometric primitives, and place those primitives in a graphic scene for rendering or export. The tree also shows Valentina, SVG, and DXF format support and several painter backends; their detailed runtime wiring is not established by the sampled excerpts, so those links are marked unverified or omitted.

Main entry points: [`Patro/GraphicEngine/GraphicScene/GraphicItem.py`](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/GraphicItem.py) (Graphic items), [`Patro/Pattern/SketchOperation.py`](https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/SketchOperation.py) (Sketch operations), [`Patro/GraphicEngine/GraphicScene/Scene.py`](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/Scene.py) (Graphic scene), [`Patro/GeometryEngine/Path.py`](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Path.py) (Curves and paths)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_drafting["Pattern drafting"]
  node_sketch["Pattern sketch<br/>[Sketch.py]"]
  node_operations["Sketch operations<br/>[SketchOperation.py]"]
  node_calculator["Expression calculator<br/>[Calculator.py]"]
  node_pattern["Pattern model<br/>[Pattern.py]"]
end

subgraph group_geometry["Geometry engine"]
  node_geometry["Geometric primitives<br/>[Primitive.py]"]
  node_vectors["Vectors and transforms<br/>[Vector.py]"]
  node_curves["Curves and paths<br/>[Path.py]"]
  node_bezier["Bezier curves<br/>[Bezier.py]"]
  node_conics["Conics<br/>[Conic.py]"]
  node_segments["Segments and lines<br/>[Segment.py]"]
  node_polygons["Polygons<br/>[Polygon.py]"]
end

subgraph group_graphics["Graphics and painters"]
  node_scene["Graphic scene<br/>[Scene.py]"]
  node_items["Graphic items<br/>[GraphicItem.py]"]
  node_styles["Graphic styles<br/>[__init__.py]"]
  node_qt_app["Qt application<br/>[QmlApplication.py]"]
  node_qt_painter["Qt painter<br/>[QtPainter.py]"]
  node_other_painters["Other painters"]
end

subgraph group_formats["Formats and measurements"]
  node_measurements["Body measurements<br/>[Measurement.py]"]
  node_valentina_measurements["Valentina measurements<br/>[Measurement.py]"]
  node_valentina_pattern["Valentina pattern format<br/>[Pattern.py]"]
  node_vit["VIT format<br/>[VitFormat.py]"]
  node_svg_format["SVG format<br/>[SvgFormat.py]"]
  node_svg_file["SVG file I/O<br/>[SvgFile.py]"]
  node_dxf_import["DXF importer<br/>[Importer.py]"]
  node_dxf_polyline["DXF polylines<br/>[Polyline.py]"]
  node_textile["Textile technology"]
end

subgraph group_common["Shared utilities"]
  node_math["Math helpers<br/>[Functions.py]"]
  node_dag["Dependency graph"]
end

node_designer(("Pattern designer"))

node_designer -.->|"defines sketch"| node_sketch
node_sketch -.->|"organizes operations"| node_operations
node_operations -->|"evaluates expressions"| node_calculator
node_operations -->|"registers dependencies"| node_dag
node_measurements -.->|"supplies inputs"| node_sketch
node_valentina_measurements -.->|"imports data"| node_measurements
node_valentina_pattern -.->|"loads pattern"| node_sketch
node_vit -->|"reads operations"| node_operations
node_operations -.->|"constructs geometry"| node_geometry
node_geometry -.->|"uses vectors"| node_vectors
node_curves -->|"uses curves"| node_bezier
node_curves -->|"uses conics"| node_conics
node_segments -->|"extends primitives"| node_geometry
node_polygons -->|"builds edges"| node_segments
node_scene -->|"creates items"| node_items
node_scene -->|"accepts paths"| node_curves
node_scene -->|"accepts polygons"| node_polygons
node_items -->|"handles curves"| node_bezier
node_items -->|"handles conics"| node_conics
node_items -->|"handles paths"| node_curves
node_qt_app -->|"configures painter"| node_qt_painter
node_qt_painter -->|"renders scene"| node_scene
node_qt_painter -->|"renders items"| node_items
node_items -.->|"uses styles"| node_styles
node_other_painters -.->|"renders scene"| node_scene
node_svg_format -->|"converts paths"| node_curves
node_svg_file -.->|"reads and writes"| node_svg_format
node_dxf_import -.->|"imports polylines"| node_dxf_polyline
node_dxf_polyline -->|"uses segments"| node_segments
node_dxf_polyline -->|"uses conics"| node_conics
node_vit -->|"uses vectors"| node_vectors
node_vectors -.->|"uses helpers"| node_math

click node_sketch "https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Sketch.py"
click node_operations "https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/SketchOperation.py"
click node_calculator "https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Calculator.py"
click node_pattern "https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Pattern.py"
click node_measurements "https://github.com/fabricesalvaire/patro/blob/master/Patro/Measurement/Measurement.py"
click node_valentina_measurements "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/Measurement.py"
click node_valentina_pattern "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/Pattern.py"
click node_vit "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/VitFormat.py"
click node_geometry "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Primitive.py"
click node_vectors "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Vector.py"
click node_curves "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Path.py"
click node_bezier "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Bezier.py"
click node_conics "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Conic.py"
click node_segments "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Segment.py"
click node_polygons "https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Polygon.py"
click node_scene "https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/Scene.py"
click node_items "https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/GraphicItem.py"
click node_styles "https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicStyle/__init__.py"
click node_qt_app "https://github.com/fabricesalvaire/patro/blob/master/Patro/QtApplication/QmlApplication.py"
click node_qt_painter "https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/Painter/QtPainter.py"
click node_other_painters "https://github.com/fabricesalvaire/patro/tree/master/Patro/GraphicEngine/Painter"
click node_svg_format "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Svg/SvgFormat.py"
click node_svg_file "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Svg/SvgFile.py"
click node_dxf_import "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Dxf/Importer.py"
click node_dxf_polyline "https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Dxf/Polyline.py"
click node_textile "https://github.com/fabricesalvaire/patro/tree/master/Patro/TextileTechnology"
click node_math "https://github.com/fabricesalvaire/patro/blob/master/Patro/Common/Math/Functions.py"
click node_dag "https://github.com/fabricesalvaire/patro/blob/master/Patro/Common/Graph/DirectedAcyclicGraph.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sketch,node_operations,node_calculator,node_pattern toneBlue
class node_geometry,node_vectors,node_curves,node_bezier,node_conics,node_segments,node_polygons toneAmber
class node_scene,node_items,node_styles,node_qt_app,node_qt_painter,node_other_painters toneMint
class node_measurements,node_valentina_measurements,node_valentina_pattern,node_vit,node_svg_format,node_svg_file,node_dxf_import,node_dxf_polyline,node_textile toneRose
class node_math,node_dag,node_designer toneIndigo
```

## Components

### Pattern drafting

- [Pattern sketch](https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Sketch.py): `Patro/Pattern/Sketch.py`
- [Sketch operations](https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/SketchOperation.py): `Patro/Pattern/SketchOperation.py`
- [Expression calculator](https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Calculator.py): `Patro/Pattern/Calculator.py`
- [Pattern model](https://github.com/fabricesalvaire/patro/blob/master/Patro/Pattern/Pattern.py): `Patro/Pattern/Pattern.py`

### Geometry engine

- [Geometric primitives](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Primitive.py): `Patro/GeometryEngine/Primitive.py`
- [Vectors and transforms](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Vector.py): `Patro/GeometryEngine/Vector.py`
- [Curves and paths](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Path.py): `Patro/GeometryEngine/Path.py`
- [Bezier curves](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Bezier.py): `Patro/GeometryEngine/Bezier.py`
- [Conics](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Conic.py): `Patro/GeometryEngine/Conic.py`
- [Segments and lines](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Segment.py): `Patro/GeometryEngine/Segment.py`
- [Polygons](https://github.com/fabricesalvaire/patro/blob/master/Patro/GeometryEngine/Polygon.py): `Patro/GeometryEngine/Polygon.py`

### Graphics and painters

- [Graphic scene](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/Scene.py): `Patro/GraphicEngine/GraphicScene/Scene.py`
- [Graphic items](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/GraphicScene/GraphicItem.py): `Patro/GraphicEngine/GraphicScene/GraphicItem.py`
- [Graphic styles](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicStyle/__init__.py): `Patro/GraphicStyle/__init__.py`
- [Qt application](https://github.com/fabricesalvaire/patro/blob/master/Patro/QtApplication/QmlApplication.py): `Patro/QtApplication/QmlApplication.py`
- [Qt painter](https://github.com/fabricesalvaire/patro/blob/master/Patro/GraphicEngine/Painter/QtPainter.py): `Patro/GraphicEngine/Painter/QtPainter.py`
- [Other painters](https://github.com/fabricesalvaire/patro/tree/master/Patro/GraphicEngine/Painter): `Patro/GraphicEngine/Painter`

### Formats and measurements

- [Body measurements](https://github.com/fabricesalvaire/patro/blob/master/Patro/Measurement/Measurement.py): `Patro/Measurement/Measurement.py`
- [Valentina measurements](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/Measurement.py): `Patro/FileFormat/Valentina/Measurement.py`
- [Valentina pattern format](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/Pattern.py): `Patro/FileFormat/Valentina/Pattern.py`
- [VIT format](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Valentina/VitFormat.py): `Patro/FileFormat/Valentina/VitFormat.py`
- [SVG format](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Svg/SvgFormat.py): `Patro/FileFormat/Svg/SvgFormat.py`
- [SVG file I/O](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Svg/SvgFile.py): `Patro/FileFormat/Svg/SvgFile.py`
- [DXF importer](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Dxf/Importer.py): `Patro/FileFormat/Dxf/Importer.py`
- [DXF polylines](https://github.com/fabricesalvaire/patro/blob/master/Patro/FileFormat/Dxf/Polyline.py): `Patro/FileFormat/Dxf/Polyline.py`
- [Textile technology](https://github.com/fabricesalvaire/patro/tree/master/Patro/TextileTechnology): `Patro/TextileTechnology`

### Shared utilities

- [Math helpers](https://github.com/fabricesalvaire/patro/blob/master/Patro/Common/Math/Functions.py): `Patro/Common/Math/Functions.py`
- [Dependency graph](https://github.com/fabricesalvaire/patro/blob/master/Patro/Common/Graph/DirectedAcyclicGraph.py): `Patro/Common/Graph/DirectedAcyclicGraph.py`

### Other components

- **Pattern designer**

## Connections

- Pattern designer → Pattern sketch: defines sketch
- Pattern sketch → Sketch operations: organizes operations
- Sketch operations → Expression calculator: evaluates expressions (evidence: `Patro/Pattern/SketchOperation.py`)
- Sketch operations → Dependency graph: registers dependencies (evidence: `Patro/Pattern/SketchOperation.py`)
- Body measurements → Pattern sketch: supplies inputs
- Valentina measurements → Body measurements: imports data
- Valentina pattern format → Pattern sketch: loads pattern
- VIT format → Sketch operations: reads operations (evidence: `Patro/FileFormat/Valentina/VitFormat.py`)
- Sketch operations → Geometric primitives: constructs geometry
- Geometric primitives → Vectors and transforms: uses vectors (evidence: `Patro/GeometryEngine/Vector.py`)
- Curves and paths → Bezier curves: uses curves (evidence: `Patro/GeometryEngine/Path.py`)
- Curves and paths → Conics: uses conics (evidence: `Patro/GeometryEngine/Path.py`)
- Segments and lines → Geometric primitives: extends primitives (evidence: `Patro/GeometryEngine/Segment.py`)
- Polygons → Segments and lines: builds edges (evidence: `Patro/GeometryEngine/Polygon.py`)
- Graphic scene → Graphic items: creates items (evidence: `Patro/GraphicEngine/GraphicScene/Scene.py`)
- Graphic scene → Curves and paths: accepts paths (evidence: `Patro/GraphicEngine/GraphicScene/Scene.py`)
- Graphic scene → Polygons: accepts polygons (evidence: `Patro/GraphicEngine/GraphicScene/Scene.py`)
- Graphic items → Bezier curves: handles curves (evidence: `Patro/GraphicEngine/GraphicScene/GraphicItem.py`)
- Graphic items → Conics: handles conics (evidence: `Patro/GraphicEngine/GraphicScene/GraphicItem.py`)
- Graphic items → Curves and paths: handles paths (evidence: `Patro/GraphicEngine/GraphicScene/GraphicItem.py`)
- Qt application → Qt painter: configures painter (evidence: `Patro/QtApplication/QmlApplication.py`)
- Qt painter → Graphic scene: renders scene (evidence: `Patro/GraphicEngine/Painter/QtPainter.py`)
- Qt painter → Graphic items: renders items (evidence: `Patro/GraphicEngine/Painter/QtPainter.py`)
- Graphic items → Graphic styles: uses styles
- Other painters → Graphic scene: renders scene (evidence: `Patro/GraphicEngine/Painter/QtPainter.py`)
- SVG format → Curves and paths: converts paths (evidence: `Patro/FileFormat/Svg/SvgFormat.py`)
- SVG file I/O → SVG format: reads and writes
- DXF importer → DXF polylines: imports polylines
- DXF polylines → Segments and lines: uses segments (evidence: `Patro/FileFormat/Dxf/Polyline.py`)
- DXF polylines → Conics: uses conics (evidence: `Patro/FileFormat/Dxf/Polyline.py`)
- VIT format → Vectors and transforms: uses vectors (evidence: `Patro/FileFormat/Valentina/VitFormat.py`)
- Vectors and transforms → Math helpers: uses helpers (evidence: `Patro/GeometryEngine/Vector.py`)
