KiBot/docs/build/html/notes_3d.html

246 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Notes about 3D models &mdash; KiBot 1.6.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Proposed advanced KiCad usage" href="propose.html" />
<link rel="prev" title="Notes about the position file" href="notes_position.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
KiBot
<img src="_static/kibot_370x200.png" class="logo" alt="Logo"/>
</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" aria-label="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="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage.html">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage_with_ci_cd.html">Usage for CI/CD</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Notes and extra information:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="notes_gerber.html">Notes about Gerber format</a></li>
<li class="toctree-l1"><a class="reference internal" href="notes_position.html">Notes about the position file</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Notes about 3D models</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#d-models-and-docker-images">3D models and docker images</a></li>
<li class="toctree-l2"><a class="reference internal" href="#caching-downloaded-3d-models">Caching downloaded 3D models</a></li>
<li class="toctree-l2"><a class="reference internal" href="#self-contained-projects">Self contained projects</a></li>
<li class="toctree-l2"><a class="reference internal" href="#lcsc-jlcpcb-easyeda-3d-models">LCSC/JLCPCB/EasyEDA 3D models</a></li>
<li class="toctree-l2"><a class="reference internal" href="#d-models-aliases">3D models aliases</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-handle-addons">How to handle addons</a></li>
<li class="toctree-l2"><a class="reference internal" href="#getting-a-self-contained-pcb">Getting a self contained PCB</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="propose.html">Proposed advanced KiCad usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="KiPlotYAML.html">KiPlot YAML</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Final notes:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Indices and tables:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="genindex.html">Index</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">KiBot</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Notes about 3D models</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="notes-about-3d-models">
<span id="index-0"></span><h1>Notes about 3D models<a class="headerlink" href="#notes-about-3d-models" title="Permalink to this heading"></a></h1>
<p>This section contains some notes and advices about the use of 3D models.
There are many strategies and you can choose the mix that better suits
your needs. If you have any suggestion dont hesitate in contacting me
to add them.</p>
<section id="d-models-and-docker-images">
<span id="index-1"></span><h2>3D models and docker images<a class="headerlink" href="#d-models-and-docker-images" title="Permalink to this heading"></a></h2>
<p>The default KiCad 3D models arent included in the KiBot docker images.
This is because the 3D models currently needs around 5 GB and the
current docker images are between 1 and 2.8 GB. So adding them means a
huge increase in size.</p>
<p>This is not a big problem because KiBot will download any missing 3D
model from KiCads repo.</p>
<p>As a side effect youll get errors and/or warnings about the missing 3D
models and/or KiCad environment variables pointing to them.</p>
<p>If you need to install the KiCad 3D models in one of the
<code class="docutils literal notranslate"><span class="pre">kicad_debian</span></code>, <code class="docutils literal notranslate"><span class="pre">kicad_auto</span></code> or <code class="docutils literal notranslate"><span class="pre">kicad_auto_test</span></code> images just run
the <code class="docutils literal notranslate"><span class="pre">/usr/bin/kicad_3d_install.sh</span></code> script included with the current
images.</p>
<p>If you are running the GitHub action and you want to install the KiCad
3D models use the <code class="docutils literal notranslate"><span class="pre">install3D:</span> <span class="pre">YES</span></code> option.</p>
</section>
<section id="caching-downloaded-3d-models">
<span id="index-2"></span><h2>Caching downloaded 3D models<a class="headerlink" href="#caching-downloaded-3d-models" title="Permalink to this heading"></a></h2>
<p>You can store the downloaded 3D models in a GitHub cache, an example can
be found in the following
<a class="reference external" href="https://github.com/set-soft/kibot_3d_models_cache_example">repo</a></p>
</section>
<section id="self-contained-projects">
<span id="index-3"></span><h2>Self contained projects<a class="headerlink" href="#self-contained-projects" title="Permalink to this heading"></a></h2>
<p>Try to make your project self contained. If you are using a repo this
means the repo should contain anything needed to work with your project.</p>
<p>KiCad 6 helps a lot in this regard. Now schematic files are self
contained, you dont need external files to work with them. Even with
this I think including the used symbols and footprints isnt a bad idea.
If you expect other people to edit your project then is much simpler if
the originals are in the project.</p>
<p>The 3D models are a very special case. KiCad doesnt help much in this
regard. I strongly suggest including all used 3D models in your repo.
You can then use <code class="docutils literal notranslate"><span class="pre">${KIPRJMOD}</span></code> as base for the path to the models,
this will be expanded to the current path to your project. So you can
use things like <code class="docutils literal notranslate"><span class="pre">${KIPRJMOD}/3D/MODEL_NAME</span></code> and store all the 3D
models in the <em>3D</em> folder inside your project folder.</p>
</section>
<section id="lcsc-jlcpcb-easyeda-3d-models">
<span id="index-4"></span><h2>LCSC/JLCPCB/EasyEDA 3D models<a class="headerlink" href="#lcsc-jlcpcb-easyeda-3d-models" title="Permalink to this heading"></a></h2>
<p>KiBot can download 3D models for components that has an LCSC code and
that has a 3D model at <a class="reference external" href="https://easyeda.com/">EasyEDA</a>. If the 3D
model is used locally, but not found in the repo, KiBot will try to
download it. Use the <code class="docutils literal notranslate"><span class="pre">field_lcsc_part</span></code> option if KiBot fails to detect
the schematic field containing the LCSC code.</p>
</section>
<section id="d-models-aliases">
<span id="index-5"></span><h2>3D models aliases<a class="headerlink" href="#d-models-aliases" title="Permalink to this heading"></a></h2>
<p>This is a KiCad 6 feature that was removed in KiCad 7. If you use it
please migrate to environment variables as KiCad 7 did. If you still
interested on it continue reading.</p>
<p>This is a very limited feature in KiCad. You can define an <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> and
then use <code class="docutils literal notranslate"><span class="pre">ALIAS:MODEL_NAME</span></code>. The <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> will say where to look for
<code class="docutils literal notranslate"><span class="pre">MODEL_NAME</span></code>. This looks coherent with the way KiCad handles symbols
and footprints. But it currently has a huge limitation: this information
is stored along with the user configuration and there is no way to
complement it at project level. I dont recommend using aliases because
it makes quite complicated to create self contained projects.</p>
<p>KiBot offers some mechanisms to help using aliases:</p>
<ol class="arabic simple">
<li><p>You can define your aliases in the <code class="docutils literal notranslate"><span class="pre">global</span></code> section using the
<code class="docutils literal notranslate"><span class="pre">aliases_for_3d_models</span></code> option.</p></li>
<li><p>You can use environment and text variables to define aliases. This
can be disabled using the <code class="docutils literal notranslate"><span class="pre">disable_3d_alias_as_env</span></code> option.</p></li>
</ol>
<p>The problem with this is that you must keep two lists synchronized, one
for KiCad and the other to make your project self contained.</p>
</section>
<section id="how-to-handle-addons">
<span id="index-6"></span><h2>How to handle addons<a class="headerlink" href="#how-to-handle-addons" title="Permalink to this heading"></a></h2>
<p>KiCad 6 introduces a <em>Plugin and Content Manager</em>, they can contain
footprints and 3D models. Using 3D models aliases looks like a good
solution here, but this isnt. The best solution here is to use the
<code class="docutils literal notranslate"><span class="pre">KICAD6_3RD_PARTY</span></code> variable. Instead of defining an alias pointing to
the content you can just use
<code class="docutils literal notranslate"><span class="pre">${KICAD6_3RD_PARTY}/3dmodels/FULL_PLUGIN_NAME/MODEL_NAME</span></code>. I know
this is long, but this will make your project portable. The user will
need to download the plugin, but wont need to define any alias.</p>
</section>
<section id="getting-a-self-contained-pcb">
<span id="index-7"></span><h2>Getting a self contained PCB<a class="headerlink" href="#getting-a-self-contained-pcb" title="Permalink to this heading"></a></h2>
<p>In order to help users to create self contained projects KiBot offers
some help. The following configuration:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="c1"># Example KiBot config file</span>
<span class="nt">kibot</span><span class="p">:</span>
<span class="w"> </span><span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1</span>
<span class="nt">outputs</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">export_pcb</span>
<span class="w"> </span><span class="nt">comment</span><span class="p">:</span><span class="w"> </span><span class="s">&#39;Copy</span><span class="nv"> </span><span class="s">3D</span><span class="nv"> </span><span class="s">models&#39;</span>
<span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">copy_files</span>
<span class="w"> </span><span class="nt">dir</span><span class="p">:</span><span class="w"> </span><span class="s">&#39;expoted_pcb&#39;</span>
<span class="w"> </span><span class="nt">options</span><span class="p">:</span>
<span class="w"> </span><span class="nt">files</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">source_type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3d_models</span>
<span class="w"> </span><span class="nt">dest</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3d_models+</span>
<span class="w"> </span><span class="nt">save_pcb</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
</pre></div>
</div>
<p>Will create a new PCB inside a directory called <code class="docutils literal notranslate"><span class="pre">expoted_pcb</span></code>, this
PCB will use the 3D models copied to <code class="docutils literal notranslate"><span class="pre">expoted_pcb/3d_models</span></code> using
relative paths. So you can move the new PCB file to any place, as long
as the <code class="docutils literal notranslate"><span class="pre">3d_models</span></code> directory is in the same place as the PCB.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="notes_position.html" class="btn btn-neutral float-left" title="Notes about the position file" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="propose.html" class="btn btn-neutral float-right" title="Proposed advanced KiCad usage" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2018-2023, Salvador E. Tropea/INTI/John Beard.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>