From 372fad5d2855b9fef61c77524fe4d421c71cf40a Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 31 Mar 2022 12:11:52 -0300 Subject: [PATCH] Fixed 3D problems to download 3D models for native KiCad 6 files. - Not seen on files imported from KiCad 5 Fixes #171 --- CHANGELOG.md | 9 ++++++--- kibot/out_base_3d.py | 5 +++-- tests/board_samples/kicad_6/bom.kicad_pcb | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1d109d9..172a1c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,9 +106,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `--list`: problems with layers and fields specific for the project. (INTI-CMNB/kibot_variants_arduprog#4) - Makefile: %VALUE not expanded in the directory targets. -- KiCost variants: empty DNF fields shouldn't be excluded. (#101) -- KiCost variants: problems when setting a field in a variant that doesn't - exist when no variant is selected. (#105) +- KiCost variants: + - empty DNF fields shouldn't be excluded. (#101) + - problems when setting a field in a variant that doesn't + exist when no variant is selected. (#105) - KiCost: list arguments wrongly passed. (#120) - PCB Print: to show the real name of the PCB file. (#102) - Compress: not expanding %VALUES in target dirs. (#111) @@ -117,6 +118,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update XML: Removed the side effect Bom. (#106) - Problems when using a hidden config file, using an output that needs the SCH, not specifying the SCH and more than one SCH was found. (#138) +- 3D: problems to download 3D models for native KiCad 6 files. (#171) + (not imported from KiCad 5) ## [0.11.0] - 2021-04-25 diff --git a/kibot/out_base_3d.py b/kibot/out_base_3d.py index 1e9516d7..ee2d268e 100644 --- a/kibot/out_base_3d.py +++ b/kibot/out_base_3d.py @@ -124,9 +124,10 @@ class Base3DOptions(VariantOptions): # Missing 3D model if full_name not in downloaded: logger.warning(W_MISS3D+'Missing 3D model for {}: `{}`'.format(ref, full_name)) - if self.download and m3d.m_Filename.startswith('${KISYS3DMOD}/'): + if self.download and (m3d.m_Filename.startswith('${KISYS3DMOD}/') or + m3d.m_Filename.startswith('${KICAD6_3DMODEL_DIR}/')): # This is a model from KiCad, try to download it - fname = m3d.m_Filename[14:] + fname = m3d.m_Filename[m3d.m_Filename.find('/')+1:] replace = None if full_name in downloaded: # Already downloaded diff --git a/tests/board_samples/kicad_6/bom.kicad_pcb b/tests/board_samples/kicad_6/bom.kicad_pcb index 8394f8cd..4c93b770 100644 --- a/tests/board_samples/kicad_6/bom.kicad_pcb +++ b/tests/board_samples/kicad_6/bom.kicad_pcb @@ -178,7 +178,7 @@ (net 2 "Net-(C1-Pad1)") (tstamp 55440b89-8f8a-483a-9b2b-9ccc95708f75)) (pad "2" smd roundrect (at 0.9375 0 180) (size 0.975 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND") (tstamp 3d8a4e48-dfd4-4c64-8dd3-885d6a7ed460)) - (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0805_2012Metric.step" + (model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0805_2012Metric.step" (offset (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0))