Componentsbeta for Circuit Diagram

Concepts

A component file provides the following information about your component:

  • Metadata - such as the component name e.g. Resistor
  • Properties - properties which the user can edit e.g. Resistance
  • Configurations - properties set in a specific way such that the component looks or behaves differently e.g. variable resistor
  • 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 others. 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. This 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

When you visit the editor on this website, you will be presented with a default component template. These are good starting points, since you can choose the one which is most similar to the component you want to create, and modify it as necessary.

The outer component tag should always look like the snippet below.

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

The first line is the standard XML declaration. The second line begins with the "component" element - this shows that the XML file represents a component. There is also an xmlns attribute for the component namespace.

The 1.2 inside the version attribute indicates that the XML syntax version 1.2 is being used. This is the only version supported by the compiler on this website.

Next: metadata