From 58dceb143f92bfa167165d7cbfbb4c0964d16865 Mon Sep 17 00:00:00 2001 From: Simon Schaak <9246423-sschaak@users.noreply.gitlab.com> Date: Sat, 28 Aug 2021 16:43:06 +0200 Subject: [PATCH] kicad2step: fix "ignore virtual components" option There isn't a "virtual" attribute any more, virtual components are now saved without the "smd" and "through_hole" attributes. --- utils/kicad2step/pcb/kicadfootprint.cpp | 11 ++++++++++- utils/kicad2step/pcb/kicadfootprint.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/utils/kicad2step/pcb/kicadfootprint.cpp b/utils/kicad2step/pcb/kicadfootprint.cpp index 0feaa2ec6a..fce0ddf0ca 100644 --- a/utils/kicad2step/pcb/kicadfootprint.cpp +++ b/utils/kicad2step/pcb/kicadfootprint.cpp @@ -46,6 +46,8 @@ KICADFOOTPRINT::KICADFOOTPRINT( KICADPCB* aParent ) m_parent = aParent; m_side = LAYER_NONE; m_rotation = 0.0; + m_smd = false; + m_tht = false; m_virtual = false; return; @@ -143,6 +145,9 @@ bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry ) result = parseModel( child ); } + if( !m_smd && !m_tht ) + m_virtual = true; + return result; } @@ -281,7 +286,11 @@ bool KICADFOOTPRINT::parseAttribute( SEXPR::SEXPR* data ) else if( child->IsString() ) text = child->GetString(); - if( text == "virtual" ) + if( text == "smd" ) + m_smd = true; + else if( text == "through_hole" ) + m_tht = true; + else if( text == "virtual" ) m_virtual = true; return true; diff --git a/utils/kicad2step/pcb/kicadfootprint.h b/utils/kicad2step/pcb/kicadfootprint.h index 6687b08669..e0810f9c20 100644 --- a/utils/kicad2step/pcb/kicadfootprint.h +++ b/utils/kicad2step/pcb/kicadfootprint.h @@ -69,6 +69,8 @@ private: std::string m_refdes; DOUBLET m_position; double m_rotation; // rotation (radians) + bool m_smd; // true for a SMD component + bool m_tht; // true for a through-hole component bool m_virtual; // true for a virtual (usually mechanical) component std::vector< KICADPAD* > m_pads;