File size: 1,780 Bytes
8a8f710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# STEP face and edge labels

Use pythonocc-core **7.8.1.1** with OCCT **7.8.1** and the supplied `read_labels.py`.

## Traversal

```python

from OCC.Extend.DataExchange import read_step_file

from OCC.Extend.TopologyUtils import TopologyExplorer



shape = read_step_file("model.step", as_compound=True, verbosity=False)

topology = TopologyExplorer(shape, ignore_orientation=True)

faces = list(topology.faces())

edges = list(topology.edges())

```

`face_labels[i]` labels `faces[i]`; `edge_labels[j]` labels `edges[j]`.
Both arrays contain binary integers and use zero-based indices. They cover
every face and edge returned by these traversals, including boundary and seam
edges. The same underlying primitive encountered with different orientations
is counted once (`IsSame` comparison).

Use the compound returned by `read_step_file`, retaining all transferred
shapes. Read the provided STEP without normalization, healing, simplification,
or re-export, and preserve traversal order. The indices are traversal positions,
not STEP entity numbers. Different OCC versions or traversal implementations
can change the association.

## Label files

`labels/<state-id>.json` contains:

| Field | Meaning |
|---|---|
| `query` | List of text queries sharing the target primitives |
| `face_labels` | One binary value per traversed face |
| `edge_labels` | One binary value per traversed edge |

`read_step_labels(step_path, labels_path)` returns the original OCC shape,
ordered `faces` and `edges`, and the labels. It checks the primitive counts
against the label lengths and validates binary values.

Construct any network-specific representation after reading this association,
carrying the labels through the corresponding primitive mapping.