Finishing

This page lists the steps you might like to do next after completing your component.

Compile to CDCOM

Compile your XML component into the CDCOM binary format using the following command:

> circuit-diagram-cli component my_component.xml -o my_component.cdcom

Publish on GitHub

Publish your component by raising a pull request on the components respository on GitHub.

Use in the Web Editor

To use your component in the Web Editor, raise a pull request to add it to the components respository on GitHub.

Use in Circuit Diagram Desktop

To use either an XML or CDCOM format component in Circuit Diagram Desktop, open Tools -> Components -> Components folder. Copy the component file into the directory that opens and restart Circuit Diagram. You can add new components to the toolbox by opening Tools -> Toolbox.

Circuit Diagram Desktop supports up to version 1.2 of the XML component format. To use newer XML versions, compile to CDCOM first.

Icons

To display icons in the toolbar in Circuit Diagram Desktop, the component must be compliled to CDCOM format with icons embedded. This can be done by creating the appropriate 32px square PNG images and then specifying the --resources argument when compiling. The image is used as an opacity mask so it should have a transparent background.

To use an image called icon.png for all configurations of the component, specify --resources <component_name>_32.png ./path/to/actual_icon_file.png.

For example:

> circuit-diagram-cli component resistor.xml --resources resistor_32.png ./icon.png  -o resistor.cdcom

To use a different icon for each configuration, multiple resources can be specified. You can see the list of expected icon names when compiling a component with verbose logging enabled:

> circuit-diagram-cli component resistor.xml -o resistor.cdcom --verbose
...
Icon resistor_32.png not found.
Icon resistor_64.png not found.
Icon resistor_resistor_iec_32.png not found.
Icon resistor_resistor_iec_64.png not found.
...

To specify multiple icons:

> circuit-diagram-cli \
    component resistor.xml \
    --resources resistor_32.png ./icon_1.png \
                resistor_64.png ./icon_2.png \
                resistor_resistor_iec_32.png ./icon_3.png \
    ...
    -o resistor.cdcom

To see the list of icons embedded in a CDCOM file, in Circuit Diagram Desktop, open Tools -> Components, find the component and click Details. For high resolution displays, Circuit Diagram supports 64px square icons, identified by a _64.png suffix instead of _32.png.