Skip to main content
Built-in Elements

<assembly.drawing.harnessview />

assembly.drawing.harnessview draws one assembly.cable for cable manufacturing inside an assembly.drawing.page. It shows both connectors, one line per assembly.cablewire, the pin numbers at each end and the cable's length.

import { assembly } from "tscircuit"

export default () => (
<assembly.device>
<board width={40} height={20} routingDisabled>
<connector name="J1" standard="jst_ph" pinCount={4}
footprint="jst4_ph" pcbX={-12} />
<connector name="J2" standard="jst_ph" pinCount={4}
footprint="jst4_ph" pcbX={12} />
</board>
<assembly.cable name="I2C" from=".J1" to=".J2"
length="150mm" wireAwg={26}>
<assembly.cablewire fromPin={1} toPin={1} color="red" />
<assembly.cablewire fromPin={2} toPin={2} color="black" />
<assembly.cablewire fromPin={3} toPin={3} color="blue" />
<assembly.cablewire fromPin={4} toPin={4} color="yellow" />
</assembly.cable>
<assembly.drawing.page name="i2c-cable" width={180} height={70}>
<assembly.drawing.harnessview cableRef="I2C"
width={160} height={50} />
</assembly.drawing.page>
</assembly.device>
)
Drawing 1 of 1: i2c-cable

Properties​

PropertyDescription
cableRefRequired. The cable's name, such as "I2C", or a selector that matches exactly one assembly.cable.
width, heightRequired viewport size on paper, in millimetres or unit strings.
nameView name used by sibling placement selectors.
displayNameCaption text. Defaults to the view's name, then the cable's name.
centerX, centerYViewport center relative to the page's anchorAlignment. Default: 0 on each axis.
leftOfRef, rightOfRef, aboveRef, belowRefPlace the view beside a sibling view, as on assembly.drawing.partview.
showBalloonsCircle the item numbers of the cable's wire, housings and contacts. Default: false.
childrenOptional assembly.drawing.note annotations.

What the view shows​

  • Connectors. Each end is drawn from the cable's connector definition and labeled with the cable's fromConnectorName or toConnectorName. Without those, the ends are labeled A and B.
  • Pin numbers. The first and last positions are always numbered. Every populated cavity is numbered when the pitch leaves room.
  • Wires. Both housings are drawn from the same face of the cable: pin 1 is at the top of the from end and at the bottom of the to end. Wires that change position cross in the middle of the run, with a gap in the wire that passes underneath.
  • Length. A cable with a length gets a dimension between the two wire exits, including its lengthTolerance. The drawing itself is not to scale, and the caption says so.

The view does not show the cable's 3D route. Wire colors appear in the wiring list.

Balloons​

showBalloons adds three callouts along the top of the view: one for each connector, giving its housing and contact item numbers, and one for the wire bundle. The numbers come from an assembly.drawing.bomtable on the same page whose partRef selects the same cable, so that table is required.

import { assembly } from "tscircuit"

export default () => (
<assembly.device>
<board width={40} height={20} routingDisabled>
<connector name="J1" standard="jst_ph" pinCount={4}
footprint="jst4_ph" pcbX={-12} />
<connector name="J2" standard="jst_ph" pinCount={4}
footprint="jst4_ph" pcbX={12} />
</board>
<assembly.cable name="POWER_DATA" from=".J1" to=".J2"
length="300mm" lengthTolerance="10mm" wireAwg={26}
fromConnectorName="P1" toConnectorName="P2">
<assembly.cablewire name="VIN" fromPin={1} toPin={4}
color="red" awg={22} />
<assembly.cablewire name="CAN_H" fromPin={2} toPin={3}
color="yellow" />
<assembly.cablewire name="CAN_L" fromPin={3} toPin={2}
color="green" />
<assembly.cablewire name="GND" fromPin={4} toPin={1}
color="black" awg={22} />
</assembly.cable>
<assembly.drawing.page name="power-and-data" width={230} height={150}>
<assembly.drawing.harnessview cableRef="POWER_DATA"
width={200} height={70} centerY={35} showBalloons />
<assembly.drawing.wiringtable cableRef="POWER_DATA"
paperX={-108} paperY={-10} anchorAlignment="top_left" />
<assembly.drawing.bomtable partRef="POWER_DATA"
paperX={108} paperY={-10} anchorAlignment="top_right" />
</assembly.drawing.page>
</assembly.device>
)
Drawing 1 of 1: power-and-data

Several views on a page​

Harness views take part in relative placement with each other and with part views:

import { assembly } from "tscircuit"

export default () => (
<assembly.device>
<board width={60} height={30} routingDisabled>
<connector name="J1" standard="jst_ph" pinCount={2}
footprint="jst2_ph" pcbX={-20} pcbY={8} />
<connector name="J2" standard="jst_ph" pinCount={2}
footprint="jst2_ph" pcbX={20} pcbY={8} />
<connector name="J3" standard="jst_sh" pinCount={4}
footprint="jst4_sh" pcbX={-20} pcbY={-8} />
<connector name="J4" standard="jst_sh" pinCount={4}
footprint="jst4_sh" pcbX={20} pcbY={-8} />
</board>
<assembly.cable name="BATTERY" from=".J1" to=".J2"
length="120mm" wireAwg={22}
fromConnectorName="J1" toConnectorName="J2">
<assembly.cablewire name="VBAT" fromPin={1} toPin={2} color="red" />
<assembly.cablewire name="GND" fromPin={2} toPin={1} color="black" />
</assembly.cable>
<assembly.cable name="DISPLAY" from=".J3" to=".J4"
length="60mm" wireAwg={28}
fromConnectorName="J3" toConnectorName="J4">
<assembly.cablewire name="3V3" fromPin={1} toPin={4} color="red" />
<assembly.cablewire name="GND" fromPin={2} toPin={3} color="black" />
<assembly.cablewire name="SDA" fromPin={3} toPin={2} color="blue" />
<assembly.cablewire name="SCL" fromPin={4} toPin={1} color="yellow" />
</assembly.cable>
<assembly.drawing.page name="cable-set" width={280} height={150}>
<assembly.drawing.harnessview name="battery" cableRef="BATTERY"
displayName="BATTERY LEAD"
width={160} height={55} centerX={-55} centerY={38} />
<assembly.drawing.harnessview name="display" cableRef="DISPLAY"
displayName="DISPLAY CABLE"
width={160} height={55} centerX={-55} belowRef=".battery" />
<assembly.drawing.wiringtable cableRef="BATTERY" title="BATTERY LEAD"
paperX={135} paperY={62} anchorAlignment="top_right" />
<assembly.drawing.wiringtable cableRef="DISPLAY" title="DISPLAY CABLE"
paperX={135} paperY={2} anchorAlignment="top_right" />
<assembly.drawing.bomtable
paperX={135} paperY={-70} anchorAlignment="bottom_right" />
</assembly.drawing.page>
</assembly.device>
)
Drawing 1 of 1: cable-set

Notes​

A note inside the view is positioned with xOffsetFromViewCenter and yOffsetFromViewCenter:

import { assembly } from "tscircuit"

export default () => (
<assembly.device>
<board width={40} height={20} routingDisabled>
<connector name="J1" standard="jst_ph" pinCount={3}
footprint="jst3_ph" pcbX={-12} />
<connector name="J2" standard="jst_ph" pinCount={3}
footprint="jst3_ph" pcbX={12} />
</board>
<assembly.cable name="FAN" from=".J1" to=".J2"
length="200mm" lengthTolerance="5mm" wireAwg={26}
fromConnectorName="FAN" toConnectorName="MB">
<assembly.cablewire name="GND" fromPin={1} toPin={3} color="black" />
<assembly.cablewire name="12V" fromPin={2} toPin={2} color="red" />
<assembly.cablewire name="TACH" fromPin={3} toPin={1} color="yellow" />
</assembly.cable>
<assembly.drawing.page name="annotated-cable" width={200} height={95}>
<assembly.drawing.harnessview cableRef="FAN"
width={180} height={55} centerY={12}>
<assembly.drawing.note text="Sleeve with 4 mm braid, 180 mm"
xOffsetFromViewCenter={-28} yOffsetFromViewCenter={21} />
</assembly.drawing.harnessview>
<assembly.drawing.note text="Label each end with the cable name."
paperX={-90} paperY={-38} />
</assembly.drawing.page>
</assembly.device>
)
Drawing 1 of 1: annotated-cable

See the wire harness drawings guide for more examples.