This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
geda:gparts_ug [2010/10/08 20:14] ehennes Added section on bulk import |
geda:gparts_ug [2012/02/20 15:14] 127.0.0.1 external edit |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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: | ||
+ | |||
+ | {{geda:gparts-bulk-import.png|Bulk Import Dataflow}} | ||
+ | |||
+ | The import can be accomplished with the following command line when in the gparts/sql/sqlite directory: | ||
+ | |||
+ | <xterm>$ xsltproc convert.xml ../../data/companies.xml | sqlite3 sample.db</xterm> | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <file> <company> | ||
+ | <company-name>Altera</company-name> | ||
+ | <website>http://www.altera.com</website> | ||
+ | </company></file> | ||
+ | |||
+ | Use the following as an example for specifying a package. | ||
+ | <file> <package> | ||
+ | <package-name>0201(0603)</package-name> | ||
+ | <technology>SMT</technology> | ||
+ | </package></file> | ||
+ | |||
+ | 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... | ||
+ | |||
+ | <file> <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> | ||
+ | </file> | ||
+ | |||
+ | ===== 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: | ||
+ | |||
+ | - loads the symbol drawing | ||
+ | - instantiates a component from the symbol drawing | ||
+ | - places inherited attributes in the component | ||
+ | - 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. | ||
+ | |||
+ | <file> | ||
+ | T 195 200 8 10 1 1 0 0 1 | ||
+ | VALUE=$(Resistance) | ||
+ | </file> | ||