| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329 |
- <!DOCTYPE html>
- <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <title>Camlib — Cirkuix 0.5 documentation</title>
-
-
-
-
- <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
-
-
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT:'./',
- VERSION:'0.5',
- COLLAPSE_INDEX:false,
- FILE_SUFFIX:'.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
-
-
-
-
- <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
- <script type="text/javascript" src="_static/js/theme.js"></script>
-
-
-
- <script type="text/javascript">
- jQuery(function () {
- SphinxRtdTheme.StickyNav.enable();
- });
- </script>
-
-
- <link rel="top" title="Cirkuix 0.5 documentation" href="index.html"/>
- <link rel="next" title="FlatCAM Objects" href="flatcamobj.html"/>
- <link rel="prev" title="Welcome to FlatCAM’s documentation!" href="index.html"/>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
- </head>
- <body class="wy-body-for-nav" role="document">
- <div class="wy-grid-for-nav">
-
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
- <div class="wy-side-nav-search">
- <a href="index.html" class="icon icon-home"> Cirkuix</a>
- <div role="search">
- <form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
-
-
- <ul class="current">
- <li class="toctree-l1 current"><a class="current reference internal" href="">Camlib</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="#geometry">Geometry</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#gerber">Gerber</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#aperturemacro">ApertureMacro</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#excellon">Excellon</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#cncjob">CNCJob</a></li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="flatcamobj.html">FlatCAM Objects</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="flatcamobj.html#flatcamobj">FlatCAMObj</a></li>
- <li class="toctree-l2"><a class="reference internal" href="flatcamobj.html#flatcamgerber">FlatCAMGerber</a></li>
- <li class="toctree-l2"><a class="reference internal" href="flatcamobj.html#flatcamexcellon">FlatCAMExcellon</a></li>
- <li class="toctree-l2"><a class="reference internal" href="flatcamobj.html#flatcamcncjob">FlatCAMCNCjob</a></li>
- <li class="toctree-l2"><a class="reference internal" href="flatcamobj.html#flatcamgeometry">FlatCAMGeometry</a></li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="app.html">FlatCAM Application</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="app.html#app">App</a></li>
- <li class="toctree-l2"><a class="reference internal" href="app.html#plotcanvas">PlotCanvas</a></li>
- <li class="toctree-l2"><a class="reference internal" href="app.html#objectcollection">ObjectCollection</a></li>
- <li class="toctree-l2"><a class="reference internal" href="app.html#measurement">Measurement</a></li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="devman.html">FlatCAM Developer Manual</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="devman.html#options">Options</a></li>
- <li class="toctree-l2"><a class="reference internal" href="devman.html#serialization">Serialization</a></li>
- <li class="toctree-l2"><a class="reference internal" href="devman.html#geometry-processing">Geometry Processing</a></li>
- </ul>
- </li>
- </ul>
-
- </div>
-
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
-
- <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
- <i data-toggle="wy-nav-top" class="icon icon-reorder"></i>
- <a href="index.html">Cirkuix</a>
- </nav>
-
- <div class="wy-nav-content">
- <div class="rst-content">
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="index.html">Docs</a> »</li>
-
- <li>Camlib</li>
- <li class="wy-breadcrumbs-aside">
-
- <a href="_sources/camlib.txt" rel="nofollow"> View page source</a>
-
- </li>
- </ul>
- <hr/>
- </div>
- <div role="main">
-
- <div class="section" id="module-camlib">
- <span id="camlib"></span><h1>Camlib<a class="headerlink" href="#module-camlib" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="geometry">
- <h2>Geometry<a class="headerlink" href="#geometry" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="camlib.Geometry">
- <em class="property">class </em><tt class="descclassname">camlib.</tt><tt class="descname">Geometry</tt><a class="headerlink" href="#camlib.Geometry" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="method">
- <dt id="camlib.Geometry.bounds">
- <tt class="descname">bounds</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Geometry.bounds" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns coordinates of rectangular bounds
- of geometry: (xmin, ymin, xmax, ymax).</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.clear_polygon">
- <tt class="descname">clear_polygon</tt><big>(</big><em>polygon</em>, <em>tooldia</em>, <em>overlap=0.15</em><big>)</big><a class="headerlink" href="#camlib.Geometry.clear_polygon" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates geometry inside a polygon for a tool to cover
- the whole area.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.convert_units">
- <tt class="descname">convert_units</tt><big>(</big><em>units</em><big>)</big><a class="headerlink" href="#camlib.Geometry.convert_units" title="Permalink to this definition">¶</a></dt>
- <dd><p>Converts the units of the object to <tt class="docutils literal"><span class="pre">units</span></tt> by scaling all
- the geometry appropriately. This call <tt class="docutils literal"><span class="pre">scale()</span></tt>. Don’t call
- it again in descendents.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>units</strong> (<em>str</em>) – “IN” or “MM”</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Scaling factor resulting from unit change.</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">float</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.from_dict">
- <tt class="descname">from_dict</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#camlib.Geometry.from_dict" title="Permalink to this definition">¶</a></dt>
- <dd><p>Sets object’s attributes from a dictionary.
- Attributes to include are listed in <tt class="docutils literal"><span class="pre">self.ser_attrs</span></tt>.
- This method will look only for only and all the
- attributes in <tt class="docutils literal"><span class="pre">self.ser_attrs</span></tt>. They must all
- be present. Use only for deserializing saved
- objects.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>d</strong> (<em>dict</em>) – Dictionary of attributes to set in the object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.get_empty_area">
- <tt class="descname">get_empty_area</tt><big>(</big><em>boundary=None</em><big>)</big><a class="headerlink" href="#camlib.Geometry.get_empty_area" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns the complement of self.solid_geometry within
- the given boundary polygon. If not specified, it defaults to
- the rectangular bounding box of self.solid_geometry.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.isolation_geometry">
- <tt class="descname">isolation_geometry</tt><big>(</big><em>offset</em><big>)</big><a class="headerlink" href="#camlib.Geometry.isolation_geometry" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates contours around geometry at a given
- offset distance.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>offset</strong> (<em>float</em>) – Offset distance.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The buffered geometry.</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">Shapely.MultiPolygon or Shapely.Polygon</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.offset">
- <tt class="descname">offset</tt><big>(</big><em>vect</em><big>)</big><a class="headerlink" href="#camlib.Geometry.offset" title="Permalink to this definition">¶</a></dt>
- <dd><p>Offset the geometry by the given vector. Override this method.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>vect</strong> (<em>tuple</em>) – (x, y) vector by which to offset the object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.scale">
- <tt class="descname">scale</tt><big>(</big><em>factor</em><big>)</big><a class="headerlink" href="#camlib.Geometry.scale" title="Permalink to this definition">¶</a></dt>
- <dd><p>Scales all of the object’s geometry by a given factor. Override
- this method.
- :param factor: Number by which to scale.
- :type factor: float
- :return: None
- :rtype: None</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.size">
- <tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Geometry.size" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns (width, height) of rectangular
- bounds of geometry.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Geometry.to_dict">
- <tt class="descname">to_dict</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Geometry.to_dict" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns a respresentation of the object as a dictionary.
- Attributes to include are listed in <tt class="docutils literal"><span class="pre">self.ser_attrs</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A dictionary-encoded copy of the object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="gerber">
- <h2>Gerber<a class="headerlink" href="#gerber" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="camlib.Gerber">
- <em class="property">class </em><tt class="descclassname">camlib.</tt><tt class="descname">Gerber</tt><big>(</big><em>Geometry</em><big>)</big><a class="headerlink" href="#camlib.Gerber" title="Permalink to this definition">¶</a></dt>
- <dd><p><strong>ATTRIBUTES</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">apertures</span></tt> (dict): The keys are names/identifiers of each aperture.
- The values are dictionaries key/value pairs which describe the aperture. The
- type key is always present and the rest depend on the key:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="24%" />
- <col width="76%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>type</td>
- <td>(str) “C”, “R”, “O”, “P”, or “AP”</td>
- </tr>
- <tr class="row-odd"><td>others</td>
- <td>Depend on <tt class="docutils literal"><span class="pre">type</span></tt></td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">paths</span></tt> (list): A path is described by a line an aperture that follows that
- line. Each paths[i] is a dictionary:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="20%" />
- <col width="80%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>linestring</td>
- <td>(Shapely.LineString) The actual path.</td>
- </tr>
- <tr class="row-odd"><td>aperture</td>
- <td>(str) The key for an aperture in apertures.</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">flashes</span></tt> (list): Flashes are single-point strokes of an aperture. Each
- is a dictionary:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="20%" />
- <col width="80%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>loc</td>
- <td>(Point) Shapely Point indicating location.</td>
- </tr>
- <tr class="row-odd"><td>aperture</td>
- <td>(str) The key for an aperture in apertures.</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">regions</span></tt> (list): Are surfaces defined by a polygon (Shapely.Polygon),
- which have an exterior and zero or more interiors. An aperture is also
- associated with a region. Each is a dictionary:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="18%" />
- <col width="82%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>polygon</td>
- <td>(Shapely.Polygon) The polygon defining the region.</td>
- </tr>
- <tr class="row-odd"><td>aperture</td>
- <td>(str) The key for an aperture in apertures.</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">aperture_macros</span></tt> (dictionary): Are predefined geometrical structures
- that can be instanciated with different parameters in an aperture
- definition. See <tt class="docutils literal"><span class="pre">apertures</span></tt> above. The key is the name of the macro,
- and the macro itself, the value, is a <tt class="docutils literal"><span class="pre">Aperture_Macro</span></tt> object.</li>
- <li><tt class="docutils literal"><span class="pre">flash_geometry</span></tt> (list): List of (Shapely) geometric object resulting
- from <tt class="docutils literal"><span class="pre">flashes</span></tt>. These are generated from <tt class="docutils literal"><span class="pre">flashes</span></tt> in <tt class="docutils literal"><span class="pre">do_flashes()</span></tt>.</li>
- <li><tt class="docutils literal"><span class="pre">buffered_paths</span></tt> (list): List of (Shapely) polygons resulting from
- <em>buffering</em> (or thickening) the <tt class="docutils literal"><span class="pre">paths</span></tt> with the aperture. These are
- generated from <tt class="docutils literal"><span class="pre">paths</span></tt> in <tt class="docutils literal"><span class="pre">buffer_paths()</span></tt>.</li>
- </ul>
- <p><strong>USAGE</strong>:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="n">g</span> <span class="o">=</span> <span class="n">Gerber</span><span class="p">()</span>
- <span class="n">g</span><span class="o">.</span><span class="n">parse_file</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
- <span class="n">g</span><span class="o">.</span><span class="n">create_geometry</span><span class="p">()</span>
- <span class="n">do_something</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">solid_geometry</span><span class="p">)</span>
- </pre></div>
- </div>
- <dl class="method">
- <dt id="camlib.Gerber.aperture_parse">
- <tt class="descname">aperture_parse</tt><big>(</big><em>apertureId</em>, <em>apertureType</em>, <em>apParameters</em><big>)</big><a class="headerlink" href="#camlib.Gerber.aperture_parse" title="Permalink to this definition">¶</a></dt>
- <dd><p>Parse gerber aperture definition into dictionary of apertures.
- The following kinds and their attributes are supported:</p>
- <ul class="simple">
- <li><em>Circular (C)</em>: size (float)</li>
- <li><em>Rectangle (R)</em>: width (float), height (float)</li>
- <li><em>Obround (O)</em>: width (float), height (float).</li>
- <li><em>Polygon (P)</em>: diameter(float), vertices(int), [rotation(float)]</li>
- <li><em>Aperture Macro (AM)</em>: macro (ApertureMacro), modifiers (list)</li>
- </ul>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>apertureId</strong> (<em>str</em>) – Id of the aperture being defined.</li>
- <li><strong>apertureType</strong> (<em>str</em>) – Type of the aperture.</li>
- <li><strong>apParameters</strong> (<em>str</em>) – Parameters of the aperture.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Identifier of the aperture.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.buffer_paths">
- <tt class="descname">buffer_paths</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Gerber.buffer_paths" title="Permalink to this definition">¶</a></dt>
- <dd><p>This is part of the parsing process. “Thickens” the paths
- by their appertures. This will only work for circular appertures.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.create_geometry">
- <tt class="descname">create_geometry</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Gerber.create_geometry" title="Permalink to this definition">¶</a></dt>
- <dd><p>Geometry from a Gerber file is made up entirely of polygons.
- Every stroke (linear or circular) has an aperture which gives
- it thickness. Additionally, aperture strokes have non-zero area,
- and regions naturally do as well.</p>
- <p>:rtype : None
- :return: None</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.do_flashes">
- <tt class="descname">do_flashes</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Gerber.do_flashes" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates geometry for Gerber flashes (aperture on a single point).</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.fix_regions">
- <tt class="descname">fix_regions</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Gerber.fix_regions" title="Permalink to this definition">¶</a></dt>
- <dd><p>Overwrites the region polygons with fixed
- versions if found to be invalid (according to Shapely).</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="attribute">
- <dt id="camlib.Gerber.frac_digits">
- <tt class="descname">frac_digits</tt><em class="property"> = None</em><a class="headerlink" href="#camlib.Gerber.frac_digits" title="Permalink to this definition">¶</a></dt>
- <dd><p>Number of fraction digits in Gerber numbers. Used during parsing.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.get_bounding_box">
- <tt class="descname">get_bounding_box</tt><big>(</big><em>margin=0.0</em>, <em>rounded=False</em><big>)</big><a class="headerlink" href="#camlib.Gerber.get_bounding_box" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates and returns a rectangular polygon bounding at a distance of
- margin from the object’s <tt class="docutils literal"><span class="pre">solid_geometry</span></tt>. If margin > 0, the polygon
- can optionally have rounded corners of radius equal to margin.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>margin</strong> (<em>float</em>) – Distance to enlarge the rectangular bounding
- box in both positive and negative, x and y axes.</li>
- <li><strong>rounded</strong> (<em>bool</em>) – Wether or not to have rounded corners.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The bounding box.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Shapely.Polygon</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="attribute">
- <dt id="camlib.Gerber.int_digits">
- <tt class="descname">int_digits</tt><em class="property"> = None</em><a class="headerlink" href="#camlib.Gerber.int_digits" title="Permalink to this definition">¶</a></dt>
- <dd><p>Number of integer digits in Gerber numbers. Used during parsing.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.mirror">
- <tt class="descname">mirror</tt><big>(</big><em>axis</em>, <em>point</em><big>)</big><a class="headerlink" href="#camlib.Gerber.mirror" title="Permalink to this definition">¶</a></dt>
- <dd><p>Mirrors the object around a specified axis passign through
- the given point. What is affected:</p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">buffered_paths</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">flash_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">solid_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">regions</span></tt></li>
- </ul>
- <p>NOTE:
- Does not modify the data used to create these elements. If these
- are recreated, the scaling will be lost. This behavior was modified
- because of the complexity reached in this class.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>axis</strong> (<em>str</em>) – “X” or “Y” indicates around which axis to mirror.</li>
- <li><strong>point</strong> (<em>list</em>) – [x, y] point belonging to the mirror axis.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">None</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.offset">
- <tt class="descname">offset</tt><big>(</big><em>vect</em><big>)</big><a class="headerlink" href="#camlib.Gerber.offset" title="Permalink to this definition">¶</a></dt>
- <dd><p>Offsets the objects’ geometry on the XY plane by a given vector.
- These are:</p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">buffered_paths</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">flash_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">solid_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">regions</span></tt></li>
- </ul>
- <p>NOTE:
- Does not modify the data used to create these elements. If these
- are recreated, the scaling will be lost. This behavior was modified
- because of the complexity reached in this class.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>vect</strong> (<em>tuple</em>) – (x, y) offset vector.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.parse_file">
- <tt class="descname">parse_file</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#camlib.Gerber.parse_file" title="Permalink to this definition">¶</a></dt>
- <dd><p>Calls Gerber.parse_lines() with array of lines
- read from the given file.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – Gerber file to parse.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.parse_lines">
- <tt class="descname">parse_lines</tt><big>(</big><em>glines</em><big>)</big><a class="headerlink" href="#camlib.Gerber.parse_lines" title="Permalink to this definition">¶</a></dt>
- <dd><p>Main Gerber parser. Reads Gerber and populates <tt class="docutils literal"><span class="pre">self.paths</span></tt>, <tt class="docutils literal"><span class="pre">self.apertures</span></tt>,
- <tt class="docutils literal"><span class="pre">self.flashes</span></tt>, <tt class="docutils literal"><span class="pre">self.regions</span></tt> and <tt class="docutils literal"><span class="pre">self.units</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>glines</strong> (<em>list</em>) – Gerber code as list of strings, each element being
- one line of the source file.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Gerber.scale">
- <tt class="descname">scale</tt><big>(</big><em>factor</em><big>)</big><a class="headerlink" href="#camlib.Gerber.scale" title="Permalink to this definition">¶</a></dt>
- <dd><p>Scales the objects’ geometry on the XY plane by a given factor.
- These are:</p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">buffered_paths</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">flash_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">solid_geometry</span></tt></li>
- <li><tt class="docutils literal"><span class="pre">regions</span></tt></li>
- </ul>
- <p>NOTE:
- Does not modify the data used to create these elements. If these
- are recreated, the scaling will be lost. This behavior was modified
- because of the complexity reached in this class.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>factor</strong> (<em>float</em>) – Number by which to scale.</td>
- </tr>
- </tbody>
- </table>
- <p>:rtype : None</p>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="aperturemacro">
- <h2>ApertureMacro<a class="headerlink" href="#aperturemacro" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="camlib.ApertureMacro">
- <em class="property">class </em><tt class="descclassname">camlib.</tt><tt class="descname">ApertureMacro</tt><big>(</big><em>name=None</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="method">
- <dt id="camlib.ApertureMacro.append">
- <tt class="descname">append</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.append" title="Permalink to this definition">¶</a></dt>
- <dd><p>Appends a string to the raw macro.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>str</em>) – Part of the macro.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.default2zero">
- <em class="property">static </em><tt class="descname">default2zero</tt><big>(</big><em>n</em>, <em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.default2zero" title="Permalink to this definition">¶</a></dt>
- <dd><p>Pads the <tt class="docutils literal"><span class="pre">mods</span></tt> list with zeros resulting in an
- list of length n.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>n</strong> (<em>int</em>) – Length of the resulting list.</li>
- <li><strong>mods</strong> (<em>list</em>) – List to be padded.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Zero-padded list.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.ApertureMacro.from_dict">
- <tt class="descname">from_dict</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.from_dict" title="Permalink to this definition">¶</a></dt>
- <dd><p>Populates the object from a serial representation created
- with <tt class="docutils literal"><span class="pre">self.to_dict()</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>d</strong> – Serial representation of an ApertureMacro object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_centerline">
- <em class="property">static </em><tt class="descname">make_centerline</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_centerline" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (Exposure 0/1, width >=0, height >=0, x-center, y-center,
- rotation angle around origin in degrees)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_circle">
- <em class="property">static </em><tt class="descname">make_circle</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_circle" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (Exposure 0/1, Diameter >=0, X-coord, Y-coord)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.ApertureMacro.make_geometry">
- <tt class="descname">make_geometry</tt><big>(</big><em>modifiers</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_geometry" title="Permalink to this definition">¶</a></dt>
- <dd><p>Runs the macro for the given modifiers and generates
- the corresponding geometry.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>modifiers</strong> (<em>list</em>) – Modifiers (parameters) for this macro</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_lowerleftline">
- <em class="property">static </em><tt class="descname">make_lowerleftline</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_lowerleftline" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (exposure 0/1, width >=0, height >=0, x-lowerleft, y-lowerleft,
- rotation angle around origin in degrees)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_moire">
- <em class="property">static </em><tt class="descname">make_moire</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_moire" title="Permalink to this definition">¶</a></dt>
- <dd><p>Note: Specs indicate that rotation is only allowed if the center
- (x, y) == (0, 0). I will tolerate breaking this rule.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (x-center, y-center, outer_dia_outer_ring, ring thickness,
- gap, max_rings, crosshair_thickness, crosshair_len, rotation
- angle around origin in degrees)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_outline">
- <em class="property">static </em><tt class="descname">make_outline</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_outline" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_polygon">
- <em class="property">static </em><tt class="descname">make_polygon</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_polygon" title="Permalink to this definition">¶</a></dt>
- <dd><p>Note: Specs indicate that rotation is only allowed if the center
- (x, y) == (0, 0). I will tolerate breaking this rule.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (exposure 0/1, n_verts 3<=n<=12, x-center, y-center,
- diameter of circumscribed circle >=0, rotation angle around origin)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_thermal">
- <em class="property">static </em><tt class="descname">make_thermal</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_thermal" title="Permalink to this definition">¶</a></dt>
- <dd><p>Note: Specs indicate that rotation is only allowed if the center
- (x, y) == (0, 0). I will tolerate breaking this rule.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – [x-center, y-center, diameter-outside, diameter-inside,
- gap-thickness, rotation angle around origin]</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="camlib.ApertureMacro.make_vectorline">
- <em class="property">static </em><tt class="descname">make_vectorline</tt><big>(</big><em>mods</em><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.make_vectorline" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mods</strong> – (Exposure 0/1, Line width >= 0, X-start, Y-start, X-end, Y-end,
- rotation angle around origin in degrees)</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.ApertureMacro.parse_content">
- <tt class="descname">parse_content</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.parse_content" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates numerical lists for all primitives in the aperture
- macro (in <tt class="docutils literal"><span class="pre">self.raw</span></tt>) by replacing all variables by their
- values iteratively and evaluating expressions. Results
- are stored in <tt class="docutils literal"><span class="pre">self.primitives</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.ApertureMacro.to_dict">
- <tt class="descname">to_dict</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.ApertureMacro.to_dict" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns the object in a serializable form. Only the name and
- raw are required.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Dictionary representing the object. JSON ready.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="excellon">
- <h2>Excellon<a class="headerlink" href="#excellon" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="camlib.Excellon">
- <em class="property">class </em><tt class="descclassname">camlib.</tt><tt class="descname">Excellon</tt><big>(</big><em>Geometry</em><big>)</big><a class="headerlink" href="#camlib.Excellon" title="Permalink to this definition">¶</a></dt>
- <dd><p><em>ATTRIBUTES</em></p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">tools</span></tt> (dict): The key is the tool name and the value is
- a dictionary specifying the tool:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="31%" />
- <col width="69%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>C</td>
- <td>Diameter of the tool</td>
- </tr>
- <tr class="row-odd"><td>Others</td>
- <td>Not supported (Ignored).</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">drills</span></tt> (list): Each is a dictionary:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="31%" />
- <col width="69%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>point</td>
- <td>(Shapely.Point) Where to drill</td>
- </tr>
- <tr class="row-odd"><td>tool</td>
- <td>(str) A key in <tt class="docutils literal"><span class="pre">tools</span></tt></td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="camlib.Excellon.create_geometry">
- <tt class="descname">create_geometry</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.Excellon.create_geometry" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates circles of the tool diameter at every point
- specified in <tt class="docutils literal"><span class="pre">self.drills</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Excellon.mirror">
- <tt class="descname">mirror</tt><big>(</big><em>axis</em>, <em>point</em><big>)</big><a class="headerlink" href="#camlib.Excellon.mirror" title="Permalink to this definition">¶</a></dt>
- <dd><table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>axis</strong> (<em>str</em>) – “X” or “Y” indicates around which axis to mirror.</li>
- <li><strong>point</strong> (<em>list</em>) – [x, y] point belonging to the mirror axis.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">None</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Excellon.offset">
- <tt class="descname">offset</tt><big>(</big><em>vect</em><big>)</big><a class="headerlink" href="#camlib.Excellon.offset" title="Permalink to this definition">¶</a></dt>
- <dd><p>Offsets geometry on the XY plane in the object by a given vector.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>vect</strong> (<em>tuple</em>) – (x, y) offset vector.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Excellon.parse_file">
- <tt class="descname">parse_file</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#camlib.Excellon.parse_file" title="Permalink to this definition">¶</a></dt>
- <dd><p>Reads the specified file as array of lines as
- passes it to <tt class="docutils literal"><span class="pre">parse_lines()</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – The file to be read and parsed.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Excellon.parse_lines">
- <tt class="descname">parse_lines</tt><big>(</big><em>elines</em><big>)</big><a class="headerlink" href="#camlib.Excellon.parse_lines" title="Permalink to this definition">¶</a></dt>
- <dd><p>Main Excellon parser.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>elines</strong> (<em>list</em>) – List of strings, each being a line of Excellon code.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.Excellon.scale">
- <tt class="descname">scale</tt><big>(</big><em>factor</em><big>)</big><a class="headerlink" href="#camlib.Excellon.scale" title="Permalink to this definition">¶</a></dt>
- <dd><p>Scales geometry on the XY plane in the object by a given factor.
- Tool sizes, feedrates an Z-plane dimensions are untouched.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>factor</strong> (<em>float</em>) – Number by which to scale the object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">NOne</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- </div>
- <div class="section" id="cncjob">
- <h2>CNCJob<a class="headerlink" href="#cncjob" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="camlib.CNCjob">
- <em class="property">class </em><tt class="descclassname">camlib.</tt><tt class="descname">CNCjob</tt><big>(</big><em>Geometry</em><big>)</big><a class="headerlink" href="#camlib.CNCjob" title="Permalink to this definition">¶</a></dt>
- <dd><p>Represents work to be done by a CNC machine.</p>
- <p><em>ATTRIBUTES</em></p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">gcode_parsed</span></tt> (list): Each is a dictionary:</li>
- </ul>
- <table border="1" class="docutils">
- <colgroup>
- <col width="34%" />
- <col width="66%" />
- </colgroup>
- <thead valign="bottom">
- <tr class="row-odd"><th class="head">Key</th>
- <th class="head">Value</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr class="row-even"><td>geom</td>
- <td>(Shapely.LineString) Tool path (XY plane)</td>
- </tr>
- <tr class="row-odd"><td>kind</td>
- <td>(string) “AB”, A is “T” (travel) or
- “C” (cut). B is “F” (fast) or “S” (slow).</td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="camlib.CNCjob.gcode_parse">
- <tt class="descname">gcode_parse</tt><big>(</big><big>)</big><a class="headerlink" href="#camlib.CNCjob.gcode_parse" title="Permalink to this definition">¶</a></dt>
- <dd><p>G-Code parser (from self.gcode). Generates dictionary with
- single-segment LineString’s and “kind” indicating cut or travel,
- fast or feedrate speed.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.generate_from_excellon">
- <tt class="descname">generate_from_excellon</tt><big>(</big><em>exobj</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.generate_from_excellon" title="Permalink to this definition">¶</a></dt>
- <dd><p>Generates G-code for drilling from Excellon object.
- self.gcode becomes a list, each element is a
- different job for each tool in the excellon code.</p>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.generate_from_excellon_by_tool">
- <tt class="descname">generate_from_excellon_by_tool</tt><big>(</big><em>exobj</em>, <em>tools='all'</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.generate_from_excellon_by_tool" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates gcode for this object from an Excellon object
- for the specified tools.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>exobj</strong> (<em>Excellon</em>) – Excellon object to process</li>
- <li><strong>tools</strong> – Comma separated tool names</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Type:</th><td class="field-body"><p class="first">tools: str</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">None</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.generate_from_geometry">
- <tt class="descname">generate_from_geometry</tt><big>(</big><em>geometry</em>, <em>append=True</em>, <em>tooldia=None</em>, <em>tolerance=0</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.generate_from_geometry" title="Permalink to this definition">¶</a></dt>
- <dd><p>Generates G-Code from a Geometry object. Stores in <tt class="docutils literal"><span class="pre">self.gcode</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>geometry</strong> (<em>Geometry</em>) – Geometry defining the toolpath</li>
- <li><strong>append</strong> (<em>bool</em>) – Wether to append to self.gcode or re-write it.</li>
- <li><strong>tooldia</strong> (<em>bool</em>) – If given, sets the tooldia property but does
- not affect the process in any other way.</li>
- <li><strong>tolerance</strong> – All points in the simplified object will be within the
- tolerance distance of the original geometry.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">None</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.linear2gcode">
- <tt class="descname">linear2gcode</tt><big>(</big><em>linear</em>, <em>tolerance=0</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.linear2gcode" title="Permalink to this definition">¶</a></dt>
- <dd><p>Generates G-code to cut along the linear feature.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>linear</strong> – The path to cut along.</li>
- <li><strong>tolerance</strong> (<em>float</em>) – All points in the simplified object will be within the
- tolerance distance of the original geometry.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Type:</th><td class="field-body"><p class="first">Shapely.LinearRing or Shapely.Linear String</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">G-code to cut alon the linear feature.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.offset">
- <tt class="descname">offset</tt><big>(</big><em>vect</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.offset" title="Permalink to this definition">¶</a></dt>
- <dd><p>Offsets all the geometry on the XY plane in the object by the
- given vector.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>vect</strong> (<em>tuple</em>) – (x, y) offset vector.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.plot2">
- <tt class="descname">plot2</tt><big>(</big><em>axes, tooldia=None, dpi=75, margin=0.1, color={'C': ['#5E6CFF', '#4650BD'], 'T': ['#F0E24D', '#B5AB3A']}, alpha={'C': 1.0, 'T': 0.3}, tool_tolerance=0.0005</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.plot2" title="Permalink to this definition">¶</a></dt>
- <dd><p>Plots the G-code job onto the given axes.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>axes</strong> – Matplotlib axes on which to plot.</li>
- <li><strong>tooldia</strong> – Tool diameter.</li>
- <li><strong>dpi</strong> – Not used!</li>
- <li><strong>margin</strong> – Not used!</li>
- <li><strong>color</strong> – Color specification.</li>
- <li><strong>alpha</strong> – Transparency specification.</li>
- <li><strong>tool_tolerance</strong> – Tolerance when drawing the toolshape.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">None</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.polygon2gcode">
- <tt class="descname">polygon2gcode</tt><big>(</big><em>polygon</em>, <em>tolerance=0</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.polygon2gcode" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates G-Code for the exterior and all interior paths
- of a polygon.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>polygon</strong> (<em>Shapely.Polygon</em>) – A Shapely.Polygon</li>
- <li><strong>tolerance</strong> (<em>float</em>) – All points in the simplified object will be within the
- tolerance distance of the original geometry.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">G-code to cut along polygon.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">str</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.pre_parse">
- <tt class="descname">pre_parse</tt><big>(</big><em>gtext</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.pre_parse" title="Permalink to this definition">¶</a></dt>
- <dd><p>Separates parts of the G-Code text into a list of dictionaries.
- Used by <tt class="docutils literal"><span class="pre">self.gcode_parse()</span></tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>gtext</strong> – A single string with g-code</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="camlib.CNCjob.scale">
- <tt class="descname">scale</tt><big>(</big><em>factor</em><big>)</big><a class="headerlink" href="#camlib.CNCjob.scale" title="Permalink to this definition">¶</a></dt>
- <dd><p>Scales all the geometry on the XY plane in the object by the
- given factor. Tool sizes, feedrates, or Z-axis dimensions are
- not altered.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>factor</strong> (<em>float</em>) – Number by which to scale the object.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">None</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- </dd></dl>
- </div>
- </div>
- </div>
- <footer>
-
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
-
- <a href="flatcamobj.html" class="btn btn-neutral float-right" title="FlatCAM Objects"/>Next <span class="icon icon-circle-arrow-right"></span></a>
-
-
- <a href="index.html" class="btn btn-neutral" title="Welcome to FlatCAM’s documentation!"><span class="icon icon-circle-arrow-left"></span> Previous</a>
-
- </div>
-
- <hr/>
- <div role="contentinfo">
- <p>
- © Copyright 2014, Juan Pablo Caram.
- </p>
- </div>
- <a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
- </footer>
- </div>
- </div>
- </section>
- </div>
-
- </body>
- </html>
|