gschem: Make promoted attributes visible by default
[geda-gaf.git] / docs / wiki / geda-gparts_ug.html
blob7b0ebbfd1a7965188f8d95341d672a1630f42972
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
6 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
7 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 </head>
11 <body>
13 <p>
14 <a href="start.html" class="wikilink1" title="start.html">gEDA</a> &gt;&gt; <a href="geda-developer.html" class="wikilink1" title="geda-developer.html">Development</a> &gt;&gt; <a href="geda-gparts_tc.html" class="wikilink1" title="geda-gparts_tc.html">Parts Manager</a> &gt;&gt; <a href="geda-gparts_ug.html" class="wikilink1" title="geda-gparts_ug.html">User Guide</a>
15 </p>
17 <h1 id="partmanageruserguide">Part Manager User Guide</h1>
18 <div class="level1">
20 </div>
22 <h2 id="bulkimport">Bulk Import</h2>
23 <div class="level2">
25 <p>
26 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:
27 </p>
29 <p>
30 <a href="media/geda/gparts-bulk-import.png" class="media" target="_blank" title="geda:gparts-bulk-import.png">Bulk Import Dataflow</a>
31 </p>
33 <p>
34 The import can be accomplished with the following command line when in the gparts/sql/sqlite directory:
35 </p>
36 <pre class="code">$ xsltproc convert.xml ../../data/companies.xml | sqlite3 sample.db</pre>
38 <p>
39 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.
40 </p>
42 <p>
43 Use the following as an example for specifying a company.
44 </p>
45 <pre class="file"> &lt;company&gt;
46 &lt;company-name&gt;Altera&lt;/company-name&gt;
47 &lt;website&gt;http://www.altera.com&lt;/website&gt;
48 &lt;/company&gt;</pre>
50 <p>
51 Use the following as an example for specifying a package.
52 </p>
53 <pre class="file"> &lt;package&gt;
54 &lt;package-name&gt;0201(0603)&lt;/package-name&gt;
55 &lt;technology&gt;SMT&lt;/technology&gt;
56 &lt;/package&gt;</pre>
58 <p>
59 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...
60 </p>
61 <pre class="file"> &lt;resistor&gt;
62 &lt;company-name&gt;Bourns&lt;/company-name&gt;
63 &lt;part-number&gt;CR0603-FX-10R0ELF&lt;/part-number&gt;
64 &lt;package-name&gt;0603(1608)&lt;/package-name&gt;
65 &lt;device-name&gt;resistor&lt;/device-name&gt;
66 &lt;resistance&gt;10.000000&lt;/resistance&gt;
67 &lt;tolerance&gt;0.010000&lt;/tolerance&gt;
68 &lt;document category=&quot;Datasheet&quot;&gt;http://www.bourns.com/data/global/pdfs/CHPREZTR.pdf&lt;/document&gt;
69 &lt;/resistor&gt;</pre>
71 </div>
73 <h2 id="partattributes">Part Attributes</h2>
74 <div class="level2">
76 <p>
77 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:
78 </p>
79 <ol>
80 <li class="level1"><div class="li"> loads the symbol drawing</div>
81 </li>
82 <li class="level1"><div class="li"> instantiates a component from the symbol drawing</div>
83 </li>
84 <li class="level1"><div class="li"> places inherited attributes in the component</div>
85 </li>
86 <li class="level1"><div class="li"> performs macro expansion on inherited attributes</div>
87 </li>
88 </ol>
90 <p>
91 Currently, macros can only be used in attributes that get promoted. The logic for attribute promotion must match between gschem and the part manager.
92 </p>
94 <p>
95 The following gschem file snippet shows the macro used place the field from the database column &#039;Resistance&#039; into the &#039;VALUE&#039; attribute.
96 </p>
97 <pre class="file">T 195 200 8 10 1 1 0 0 1
98 VALUE=$(Resistance)</pre>
100 </div>
101 </body>
102 </html>