[3D outputs][Added] Option to disable LCSC 3D model download

- `download_lcsc`
 See #415
This commit is contained in:
Salvador E. Tropea 2023-09-24 19:50:30 -03:00
parent e6a8677cef
commit 549385a139
8 changed files with 54 additions and 1 deletions

View File

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Internal templates:
- 3DRender_top, 3DRender_top_straight, 3DRender_bottom and
3DRender_bottom_straight: to generate simple and quick 3D renders.
- 3D outputs:
- `download_lcsc` option to disable LCSC 3D model download (See #415)
- BoM:
- Support for ${field} expansion. (#471)
- LCSC links (SchrodingersGat/KiBoM#190)

View File

@ -180,6 +180,11 @@ outputs:
# If you want to cache the downloaded files specify a directory using the
# KIBOT_3D_MODELS environment variable
download: true
# [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
# them from LCSC database. In order to work you'll need to provide the LCSC
# part number. The field containing the LCSC part number is defined by the
# `field_lcsc_part` global variable
download_lcsc: true
# [list(string)=[]] List of components to highlight
highlight: []
# [boolean=false] Highlight over the component (not under)
@ -673,6 +678,11 @@ outputs:
# If you want to cache the downloaded files specify a directory using the
# KIBOT_3D_MODELS environment variable
download: true
# [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
# them from LCSC database. In order to work you'll need to provide the LCSC
# part number. The field containing the LCSC part number is defined by the
# `field_lcsc_part` global variable
download_lcsc: true
# [list(dict)] Which files will be included
files:
# [string=''] Destination directory inside the output dir, empty means the same of the file
@ -2956,6 +2966,11 @@ outputs:
# If you want to cache the downloaded files specify a directory using the
# KIBOT_3D_MODELS environment variable
download: true
# [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
# them from LCSC database. In order to work you'll need to provide the LCSC
# part number. The field containing the LCSC part number is defined by the
# `field_lcsc_part` global variable
download_lcsc: true
# [number=720] Image height (aprox.)
height: 720
# [list(string)=[]] List of components to highlight
@ -3225,6 +3240,11 @@ outputs:
# If you want to cache the downloaded files specify a directory using the
# KIBOT_3D_MODELS environment variable
download: true
# [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
# them from LCSC database. In order to work you'll need to provide the LCSC
# part number. The field containing the LCSC part number is defined by the
# `field_lcsc_part` global variable
download_lcsc: true
# [string='https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'] Base URL for the KiCad 3D models
kicad_3d_url: 'https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'
# [string=''] Text added to the end of the download URL.
@ -3453,6 +3473,11 @@ outputs:
# If you want to cache the downloaded files specify a directory using the
# KIBOT_3D_MODELS environment variable
download: true
# [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
# them from LCSC database. In order to work you'll need to provide the LCSC
# part number. The field containing the LCSC part number is defined by the
# `field_lcsc_part` global variable
download_lcsc: true
# [list(string)=[]] List of components to highlight
highlight: []
# [boolean=false] Highlight over the component (not under)

View File

@ -49,6 +49,10 @@ Parameters:
- ``dnf_filter`` :index:`: <pair: output - blender_export - options - pcb3d; dnf_filter>` [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- ``download_lcsc`` :index:`: <pair: output - blender_export - options - pcb3d; download_lcsc>` [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable.
- ``highlight`` :index:`: <pair: output - blender_export - options - pcb3d; highlight>` [list(string)=[]] List of components to highlight.
- ``highlight_on_top`` :index:`: <pair: output - blender_export - options - pcb3d; highlight_on_top>` [boolean=false] Highlight over the component (not under).

View File

@ -54,6 +54,10 @@ Parameters:
- ``dnf_filter`` :index:`: <pair: output - copy_files - options; dnf_filter>` [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- ``download_lcsc`` :index:`: <pair: output - copy_files - options; download_lcsc>` [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable.
- ``follow_links`` :index:`: <pair: output - copy_files - options; follow_links>` [boolean=true] Store the file pointed by symlinks, not the symlink.
- ``kicad_3d_url`` :index:`: <pair: output - copy_files - options; kicad_3d_url>` [string='https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'] Base URL for the KiCad 3D models.
- ``kicad_3d_url_suffix`` :index:`: <pair: output - copy_files - options; kicad_3d_url_suffix>` [string=''] Text added to the end of the download URL.

View File

@ -58,6 +58,10 @@ Parameters:
- ``dnf_filter`` :index:`: <pair: output - render_3d - options; dnf_filter>` [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- ``download_lcsc`` :index:`: <pair: output - render_3d - options; download_lcsc>` [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable.
- ``height`` :index:`: <pair: output - render_3d - options; height>` [number=720] Image height (aprox.).
- ``highlight`` :index:`: <pair: output - render_3d - options; highlight>` [list(string)=[]] List of components to highlight.

View File

@ -38,6 +38,10 @@ Parameters:
- ``dnf_filter`` :index:`: <pair: output - step - options; dnf_filter>` [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- ``download_lcsc`` :index:`: <pair: output - step - options; download_lcsc>` [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable.
- ``kicad_3d_url`` :index:`: <pair: output - step - options; kicad_3d_url>` [string='https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'] Base URL for the KiCad 3D models.
- ``kicad_3d_url_suffix`` :index:`: <pair: output - step - options; kicad_3d_url_suffix>` [string=''] Text added to the end of the download URL.
Can be used to pass variables to the GET request, i.e. ?VAR1=VAL1&VAR2=VAL2.

View File

@ -41,6 +41,10 @@ Parameters:
- ``dnf_filter`` :index:`: <pair: output - vrml - options; dnf_filter>` [string|list(string)='_none'] Name of the filter to mark components as not fitted.
A short-cut to use for simple cases where a variant is an overkill.
- ``download_lcsc`` :index:`: <pair: output - vrml - options; download_lcsc>` [boolean=true] In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable.
- ``highlight`` :index:`: <pair: output - vrml - options; highlight>` [list(string)=[]] List of components to highlight.
- ``highlight_on_top`` :index:`: <pair: output - vrml - options; highlight_on_top>` [boolean=false] Highlight over the component (not under).

View File

@ -133,6 +133,11 @@ class Base3DOptions(VariantOptions):
They are downloaded to a temporal directory and discarded.
If you want to cache the downloaded files specify a directory using the
KIBOT_3D_MODELS environment variable """
self.download_lcsc = True
""" In addition to try to download the 3D models from KiCad git also try to get
them from LCSC database. In order to work you'll need to provide the LCSC
part number. The field containing the LCSC part number is defined by the
`field_lcsc_part` global variable """
self.kicad_3d_url = 'https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'
""" Base URL for the KiCad 3D models """
self.kicad_3d_url_suffix = ''
@ -147,6 +152,7 @@ class Base3DOptions(VariantOptions):
super().copy_options(ref)
self.no_virtual = ref.no_virtual
self.download = ref.download
self.download_lcsc = ref.download_lcsc
self.kicad_3d_url = ref.kicad_3d_url
self.kicad_3d_url_suffix = ref.kicad_3d_url_suffix
@ -494,7 +500,7 @@ class Base3DOptions(VariantOptions):
# Missing 3D model
if self.download:
replace = self.try_download_kicad(m3d.m_Filename, full_name, downloaded, rel_dirs, force_wrl)
if replace is None:
if replace is None and self.download_lcsc:
replace = self.try_download_easyeda(m3d.m_Filename, full_name, downloaded, sch_comp, lcsc_field)
if replace:
replace = self.do_colored_tht_resistor(replace, sch_comp, used_extra)