# 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/.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.