gerbvhtdocs/doxygen/example4_8c-example.html

80 lines
6.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>gerbv: example4.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>example4.c</h1><div class="fragment"><pre class="fragment"><span class="comment">/*------------------------------------------------------------------------------</span>
<span class="comment"> Filename: example4.c</span>
<span class="comment"> </span>
<span class="comment"> Description: Loads example4-input.gbx, searches through the file and</span>
<span class="comment"> removes any entities with a width less than 60mils, and re-exports</span>
<span class="comment"> the modified image to a new RS274X file.</span>
<span class="comment"></span>
<span class="comment"> Instructions: Make sure you are in the example-code directory, and compile</span>
<span class="comment"> this program with the following command:</span>
<span class="comment"></span>
<span class="comment"> gcc -Wall -g `pkg-config --cflags gtk+-2.0 glib-2.0 libgerbv` `pkg-config \</span>
<span class="comment">--libs gtk+-2.0 glib-2.0 libgerbv` example4.c -o example4</span>
<span class="comment"></span>
<span class="comment"> Run with the following command:</span>
<span class="comment"> </span>
<span class="comment"> ./example4</span>
<span class="comment"></span>
<span class="comment">------------------------------------------------------------------------------*/</span>
<span class="preprocessor">#include "<a class="code" href="gerbv_8h.html" title="The main header file for the libgerbv library.">gerbv.h</a>"</span>
<span class="keywordtype">int</span>
main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {
<a name="_a0"></a><a class="code" href="structgerbv__image__t.html">gerbv_image_t</a> *workingImage;
<a name="_a1"></a><a class="code" href="structgerbv__net.html">gerbv_net_t</a> *currentNet;
<span class="comment">/* parse and create the image */</span>
workingImage = <a name="a2"></a><a class="code" href="gerbv_8c.html#58e7e7e29c445f965db9a142af542931" title="Parse a RS274X file and return the parsed image.">gerbv_create_rs274x_image_from_filename</a> (<span class="stringliteral">"example4-input.gbx"</span>);
<span class="comment">/* make sure we parsed the file */</span>
<span class="keywordflow">if</span> (workingImage == NULL)
g_error (<span class="stringliteral">"There was an error parsing the file."</span>);
<span class="comment">/* run through all the nets in the layer */</span>
<span class="keywordflow">for</span> (currentNet = workingImage-&gt;<a name="a3"></a><a class="code" href="structgerbv__image__t.html#4ce3cbd8ab0949d0da18653890184120">netlist</a>; currentNet; currentNet = currentNet-&gt;<a name="a4"></a><a class="code" href="structgerbv__net.html#74453be5449de76efa6cc12df4b2886c">next</a>){
<span class="comment">/* check if the net aperture is a circle and has diameter &lt; 0.060 inches */</span>
<span class="keywordflow">if</span> ((currentNet-&gt;<a name="a5"></a><a class="code" href="structgerbv__net.html#5cabb2f3b512a328ff8dc7e6ef0c803b">aperture_state</a> != <a name="a6"></a><a class="code" href="gerbv_8h.html#1bde819e0800e9b6efd3718c28b6c8f521b7ab32e7803243140cc7abc199eed1">GERBV_APERTURE_STATE_OFF</a>) &amp;&amp;
(workingImage-&gt;<a name="a7"></a><a class="code" href="structgerbv__image__t.html#b40defce85ca280ecf3804fad90fc308">aperture</a>[currentNet-&gt;<a name="a8"></a><a class="code" href="structgerbv__net.html#f4db0779d7e69e16f525fef3044897fd">aperture</a>] != NULL) &amp;&amp;
(workingImage-&gt;<a class="code" href="structgerbv__image__t.html#b40defce85ca280ecf3804fad90fc308">aperture</a>[currentNet-&gt;<a class="code" href="structgerbv__net.html#f4db0779d7e69e16f525fef3044897fd">aperture</a>]-&gt;type == <a name="a9"></a><a class="code" href="gerbv_8h.html#c99303749c4afdc6a24eafbfa37e1237562331d94d824b3711bd0c8b7296e366">GERBV_APTYPE_CIRCLE</a>) &amp;&amp;
(workingImage-&gt;<a class="code" href="structgerbv__image__t.html#b40defce85ca280ecf3804fad90fc308">aperture</a>[currentNet-&gt;<a class="code" href="structgerbv__net.html#f4db0779d7e69e16f525fef3044897fd">aperture</a>]-&gt;parameter[0] &lt; 0.060)){
<span class="comment">/* we found a path which meets the criteria, so delete the net for</span>
<span class="comment"> demostration purposes */</span>
<a name="a10"></a><a class="code" href="gerb__image_8c.html#b87698f88596ba0afd72bc4644e95db5" title="Delete a net in an existing image.">gerbv_image_delete_net</a> (currentNet);
}
}
<span class="comment">/* export the modified image to a new rs274x file */</span>
<a name="a11"></a><a class="code" href="export-rs274x_8c.html#49e264bfff8ce4ae783c173b48bba31d" title="Export an image to a new file in RS274X format.">gerbv_export_rs274x_file_from_image</a> (<span class="stringliteral">"example4-output.gbx"</span>, workingImage);
<span class="comment">/* destroy all created structures */</span>
<a name="a12"></a><a class="code" href="gerb__image_8c.html#2394060b1868594b1ae8b8edcca793e9" title="Free an image structure.">gerbv_destroy_image</a> (workingImage);
<span class="keywordflow">return</span> 0;
}
</pre></div> </div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Aug 19 00:14:47 2008 for gerbv by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>