gEDA » Development » Parts Manager » User Guide

# Part Manager User Guide

## Bulk Import

Currently, the part manager only provides a command line interface for bulk import of data. XSLT converts XML data into SQL using a stylesheet. Then, the SQL can be read by a command line interface for the database. The following diagram shows the dataflow for a bulk import:

The import can be accomplished with the following command line when in the gparts/sql/sqlite directory:

    $ xsltproc convert.xml ../../data/companies.xml | sqlite3 sample.db

See the XML files in the gparts/data directory for examples. Any combination of company, package, and part elements can be used within the data element.

Use the following as an example for specifying a company.

        <company>
            <company-name>Altera</company-name>
            <website>http://www.altera.com</website>
        </company>

Use the following as an example for specifying a package.

        <package>
            <package-name>0201(0603)</package-name>
            <technology>SMT</technology>
        </package>

Use the following as an example for specifying a resistor. The resistor, as any part, can have multiple document elements associated with it. The category specifies the type of document, such as datasheet, user manual, errata, etc…

        <resistor>
            <company-name>Bourns</company-name>
            <part-number>CR0603-FX-10R0ELF</part-number>
            <package-name>0603(1608)</package-name>
            <device-name>resistor</device-name>
            <resistance>10.000000</resistance>
            <tolerance>0.010000</tolerance>
            <document category="Datasheet">http://www.bourns.com/data/global/pdfs/CHPREZTR.pdf</document>
        </resistor>

## Part Attributes

The part manager places database fields into component attributes using macros. The macros use the form $(column_name). Unfortunately, this mechanism requires modification of symbols in the library for use with the part manager. The part manager performs the operation in the following steps:

1. loads the symbol drawing
2. instantiates a component from the symbol drawing
3. places inherited attributes in the component
4. performs macro expansion on inherited attributes

Currently, macros can only be used in attributes that get promoted. The logic for attribute promotion must match between gschem and the part manager.

The following gschem file snippet shows the macro used place the field from the database column 'Resistance' into the 'VALUE' attribute.

    T 195 200 8 10 1 1 0 0 1
    VALUE=$(Resistance)