Concepts

The component XML file defines the following information about your component:

  • Metadata - such as the component name e.g. Resistor
  • Properties - properties the user can edit e.g. Resistance
  • Connections - tells Circuit Diagram where on your component other components can connect
  • Render information - what your component should look like

Units

All measurements are in pixels, and you should aim for the size of your component to fit in with the existing components. As a reference, wires are always 2 pixels thick.

Grid

When placing, moving or resizing components in Circuit Diagram, they are always aligned to a grid. The grid is made up of 10 pixel squares, so the size of a component will always be a multiple of 10 pixels.

The Component File

The Components repository is a good place to see examples of how the existing components work. This documentation describes each part of the component file in detail.

The root XML element is the component tag. The xmlns attribute for the component namespace must always be included.

<!--?xml version="1.0" encoding="utf-8"?-->
<component version="1.3"
           xmlns="http://schemas.circuit-diagram.org/circuitDiagramDocument/2012/component/xml">
    ...
</component>

The version attribute indicates which feature set the component targets. In this documentation, features that are only available in certain component XML versions will be indicated.

In general, a lower version is more compatible with older versions of Circuit Diagram, while newer versions have more features available.

Next: metadata