# degravity/automate architecture

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

- Interactive diagram: https://gitdiagram.com/degravity/automate
- Repository: https://github.com/degravity/automate

## Overview

AutoMate is a CAD-assembly mating dataset and learning toolkit. Its core workflow loads CAD parts into native B-rep/topology data, converts those data into feature-rich graph examples, and processes them with a topology-aware neural model; the package also exposes mating-coordinate-frame and equivalence-class functionality. The sampled sources show feature extraction, model internals, and a configurable train/test runner, but not a complete prediction or assembly-mating workflow. Dashed links mark runtime wiring that is dynamic or not established by the excerpts.

Main entry points: [`automate/util.py`](https://github.com/degravity/automate/blob/main/automate/util.py) (Model runner), [`automate/brep.py`](https://github.com/degravity/automate/blob/main/automate/brep.py) (Part dataset), [`automate/sbgcn.py`](https://github.com/degravity/automate/blob/main/automate/sbgcn.py) (Topology GNN), [`cpp/part.cpp`](https://github.com/degravity/automate/blob/main/cpp/part.cpp) (Native part processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cad["CAD geometry"]
  node_nativepart["Native part processing<br/>[part.cpp]"]
  node_pybinding["Python CAD bindings<br/>[automate.cpp]"]
  node_mcf["Mating frames<br/>[part.h]"]
  node_equivalence["Equivalence classes<br/>[eclass.cpp]"]
  node_lsh["Spatial hashing<br/>[lsh.cpp]"]
  node_disjointset["Disjoint sets<br/>[disjointset.cpp]"]
end

subgraph group_data["Graph data"]
  node_partdataset["Part dataset<br/>[brep.py]"]
  node_graphfeatures["B-rep graph features<br/>[brep.py]"]
  node_conversions["Object conversion<br/>[conversions.py]"]
end

subgraph group_learning["Learning"]
  node_curveencoder["Curve encoder<br/>[uvnet_encoders.py]"]
  node_surfaceencoder["Surface encoder<br/>[uvnet_encoders.py]"]
  node_sbgcn["Topology GNN<br/>[sbgcn.py]"]
end

subgraph group_runtime["Runtime and utilities"]
  node_runner["Model runner<br/>[util.py]"]
end

node_user(("Research user"))
node_cadfiles["CAD part files"]
node_trainer["Training runtime"]

node_user -->|"configures and runs"| node_runner
node_cadfiles -.->|"loads geometry"| node_nativepart
node_pybinding -->|"exposes Part"| node_nativepart
node_partdataset -->|"constructs Part"| node_pybinding
node_partdataset -->|"converts objects"| node_conversions
node_partdataset -->|"builds graph data"| node_graphfeatures
node_mcf -.->|"defines part outputs"| node_nativepart
node_sbgcn -->|"uses curve encoder"| node_curveencoder
node_sbgcn -->|"uses surface encoder"| node_surfaceencoder
node_equivalence -->|"uses spatial index"| node_lsh
node_equivalence -->|"uses unions"| node_disjointset
node_runner -->|"configures and calls"| node_trainer
node_runner -.->|"loads configured model"| node_sbgcn
node_runner -.->|"loads configured data"| node_partdataset

click node_nativepart "https://github.com/degravity/automate/blob/main/cpp/part.cpp"
click node_pybinding "https://github.com/degravity/automate/blob/main/cpp/automate.cpp"
click node_mcf "https://github.com/degravity/automate/blob/main/cpp/part.h"
click node_partdataset "https://github.com/degravity/automate/blob/main/automate/brep.py"
click node_graphfeatures "https://github.com/degravity/automate/blob/main/automate/brep.py"
click node_conversions "https://github.com/degravity/automate/blob/main/automate/conversions.py"
click node_curveencoder "https://github.com/degravity/automate/blob/main/automate/uvnet_encoders.py"
click node_surfaceencoder "https://github.com/degravity/automate/blob/main/automate/uvnet_encoders.py"
click node_sbgcn "https://github.com/degravity/automate/blob/main/automate/sbgcn.py"
click node_equivalence "https://github.com/degravity/automate/blob/main/cpp/eclass.cpp"
click node_lsh "https://github.com/degravity/automate/blob/main/cpp/lsh.cpp"
click node_disjointset "https://github.com/degravity/automate/blob/main/cpp/disjointset.cpp"
click node_runner "https://github.com/degravity/automate/blob/main/automate/util.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_nativepart,node_pybinding,node_mcf,node_equivalence,node_lsh,node_disjointset,node_user toneBlue
class node_partdataset,node_graphfeatures,node_conversions toneAmber
class node_curveencoder,node_surfaceencoder,node_sbgcn toneMint
class node_runner toneRose
class node_cadfiles,node_trainer toneIndigo
```

## Components

### CAD geometry

- [Native part processing](https://github.com/degravity/automate/blob/main/cpp/part.cpp): `cpp/part.cpp`
- [Python CAD bindings](https://github.com/degravity/automate/blob/main/cpp/automate.cpp): `cpp/automate.cpp`
- [Mating frames](https://github.com/degravity/automate/blob/main/cpp/part.h): `cpp/part.h`
- [Equivalence classes](https://github.com/degravity/automate/blob/main/cpp/eclass.cpp): `cpp/eclass.cpp`
- [Spatial hashing](https://github.com/degravity/automate/blob/main/cpp/lsh.cpp): `cpp/lsh.cpp`
- [Disjoint sets](https://github.com/degravity/automate/blob/main/cpp/disjointset.cpp): `cpp/disjointset.cpp`

### Graph data

- [Part dataset](https://github.com/degravity/automate/blob/main/automate/brep.py): `automate/brep.py`
- [B-rep graph features](https://github.com/degravity/automate/blob/main/automate/brep.py): `automate/brep.py`
- [Object conversion](https://github.com/degravity/automate/blob/main/automate/conversions.py): `automate/conversions.py`

### Learning

- [Curve encoder](https://github.com/degravity/automate/blob/main/automate/uvnet_encoders.py): `automate/uvnet_encoders.py`
- [Surface encoder](https://github.com/degravity/automate/blob/main/automate/uvnet_encoders.py): `automate/uvnet_encoders.py`
- [Topology GNN](https://github.com/degravity/automate/blob/main/automate/sbgcn.py): `automate/sbgcn.py`

### Runtime and utilities

- [Model runner](https://github.com/degravity/automate/blob/main/automate/util.py): `automate/util.py`

### Other components

- **Research user**
- **CAD part files**
- **Training runtime**

## Connections

- Research user → Model runner: configures and runs (evidence: `automate/util.py`)
- CAD part files → Native part processing: loads geometry
- Python CAD bindings → Native part processing: exposes Part (evidence: `cpp/automate.cpp`)
- Part dataset → Python CAD bindings: constructs Part (evidence: `automate/brep.py`)
- Part dataset → Object conversion: converts objects (evidence: `automate/brep.py`)
- Part dataset → B-rep graph features: builds graph data (evidence: `automate/brep.py`)
- Mating frames → Native part processing: defines part outputs (evidence: `cpp/part.cpp`)
- Topology GNN → Curve encoder: uses curve encoder (evidence: `automate/sbgcn.py`)
- Topology GNN → Surface encoder: uses surface encoder (evidence: `automate/sbgcn.py`)
- Equivalence classes → Spatial hashing: uses spatial index (evidence: `cpp/eclass.cpp`)
- Equivalence classes → Disjoint sets: uses unions (evidence: `cpp/eclass.cpp`)
- Model runner → Training runtime: configures and calls (evidence: `automate/util.py`)
- Model runner → Topology GNN: loads configured model
- Model runner → Part dataset: loads configured data
