---
title: "DfmViolation"
description: "A single DFM violation."
canonical_url: "https://www.rosette.dev/docs/api-reference/DfmViolation"
markdown_url: "https://www.rosette.dev/docs/api-reference/DfmViolation.md"
source_url: "https://github.com/PreFab-Photonics/rosette/blob/f086d7670645fd36c05362d696d442a2b2e74850/www/content/docs/api-reference/DfmViolation.mdx"
docs_channel: "main"
docs_revision: "f086d7670645fd36c05362d696d442a2b2e74850"
---

# DfmViolation

A single DFM violation.

Import with `from rosette.dfm import DfmViolation`.

Returned as part of a `DfmResult` or per-layer `LayerPrediction` after
running `run_dfm()`. Each violation describes a manufacturability issue
detected by comparing designed and predicted geometry.

```python
result = run_dfm(cell, layers=[Layer(1)], config=config)
for v in result.violations:
    print(f"[{v.severity}] {v.violation_type} on {v.layer}: {v.message}")
```

## Attributes



### `layer`

```python
layer: tuple[int, int]
```

The `(number, datatype)` of the affected layer.





### `violation_type`

```python
violation_type: str
```

Type of violation. One of:

* `"area_deviation"`: predicted area deviates beyond the allowed threshold
* `"feature_erasure"`: a designed feature is missing from the prediction
* `"feature_merge"`: separate designed features merged in the prediction





### `message`

```python
message: str
```

Human-readable description of the violation.





### `severity`

```python
severity: str
```

Severity level: `"error"` or `"warning"`.





### `bbox`

```python
bbox: tuple[tuple[float, float], tuple[float, float]]
```

Bounding box of the violation as `((min_x, min_y), (max_x, max_y))`.





### `max_allowed`

```python
max_allowed: float | None
```

Maximum allowed value for `area_deviation` violations, or `None` for other
violation types.





### `actual`

```python
actual: float | None
```

Actual measured value for `area_deviation` violations, or `None` for other
violation types.





### `designed_count`

```python
designed_count: int | None
```

Number of designed features, for `feature_erasure` and `feature_merge`
violations. `None` for `area_deviation`.





### `predicted_count`

```python
predicted_count: int | None
```

Number of predicted features, for `feature_erasure` and `feature_merge`
violations. `None` for `area_deviation`.