wiki:ComponentLibrary

Managing the breadboard component library

To describe how the components should look and where their connection points are we use a XML description format. The file containing the xml data is called library.xml and should be placed in the same location as the breadboard.swf.
The XML schema (dtd) can be found at: http://openlabs.bth.se/DTDs/components-1.0.dtd

Contents of the component description file

Example:

<components>
	<component type="R" value="1k" pins="2">
		<rotations>
			<rotation ox="-26" oy ="-6" image="r_1k.png" rot="0">
				<pins><pin x="-26" y="0" /><pin x="26"  y="0" /></pins>
			</rotation>
			<rotation ox="-6" oy ="-26" image="r_1k.png" rot="90">
				<pins><pin x="0" y="-26" /><pin x="0" y="26" /></pins>
			</rotation>
		</rotations>
	</component>
</components>

Description

The outermost container is called <components> and must contain a list of <component>:s. Each component has a name, value and a number of pins. It also has a list of different rotational positions it can be shown in.
Each rotation describes a offset from the center of the component image (ox, oy), an image file and a angular rotation (in degrees). By default the images are located in a subdirectory called "images" in the same directory as the breadboard.swf.
Each rotation has to describe where the connection pins are located. This is done with a list of pins with exactly as many pins as described in the <component>.
Each pin is described by an offset (x,y) from the component center.

Adding components

If you want to add new components to the library, edit the library.xml and add your component description and make sure it validates against the xml schema.

Viewing the component library

The breadboard has the ability to display a list of all components available. This is done by dynamically loading and displaying the LibraryList module, which reads library.xml file in the exact same way as the breadboard but displays all the components in a list. The LibraryList is shown by pressing the little plus button to the right of the component bin.

Last modified 7 years ago Last modified on Jul 14, 2010, 3:42:10 PM