brepjs API Reference
    Preparing search index...

    Function assignRoles

    • Auto-assign role names to a shape's faces from its operation type.

      Known primitives get semantic names from face geometry — rebuild-stable across parameter edits that preserve orientation:

      • box: cardinal names by normal ('box:top'/'bottom'/'front'/'back'/'left'/'right').
      • cylinder/cone (Z-axis): 'top'/'bottom' caps + 'lateral' wall.
      • sphere: 'sphere:surface'.

      Faces a primitive namer doesn't recognize (a rotated box's non-cardinal faces), and every face of any other operation type, fall back to positional names ('opType:face_0', 'opType:face_1', ...) — so each face always gets a role.

      Parameters

      • shape: Shape3D
      • operationType: string

      Returns Map<string, number[]>

      Map from role name to its face hash codes (one at assignment time; a role accrues more hashes only later, when updateRoles tracks a split).