Library Components - bglen/wire-harness-core GitHub Wiki

📚 Wire Harness Library (library.wh_lib)

This document outlines the structure, philosophy, and component relationships in the library.wh_lib file used by the wire harness design tool. The library file defines all reusable harness components and their rules for valid usage.


📦 Component Types

Each entry in library.wh_lib represents a standalone physical part, described with a JSON object including metadata, specs, and optionally rules. These parts can then be referenced when building schematics or 3D layouts.


Component Relationships

Components are modular. Connectors reference terminals, plugs, and accessories by part number.

{
  "type": "connector_shell",
  "part_number": "DT04-4P",
  "required_terminal_type": "0462-201-16141",
  "sealing_plug_type": "114017",
  "mating_part_numbers": ["DT06-4S"],
  "compatible_backshells": ["DT-Backshell-90", "DT-Backshell-Straight"]
}

This allows:

  • Shared use of parts like terminals across connectors

  • Visual/DRC validation of unpopulated or missing components

  • BOM auto-generation


Rules and Validation

Component-level rules

Defined in each component JSON. These are inherent to the part. These are separate from rules defined by the user for the project using [[Design Rules Check]

Examples:

  • A terminal supports AWG 18–22.

  • A connector requires sealing plugs for unused positions.


Design Philosophy

  • Reusable components: parts like terminals and backshells live once in the library and are referenced many times.

  • Context-aware logic: DRC enforces dynamic constraints.

  • Separation of data and behavior: immutable part specs live in library.wh_lib; policy lives in drc.wh_drc.


Component Creation