From a546851d6469f4dbf0c4000c4fa3c525c197bf23 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 3 Apr 2020 08:40:59 -0700 Subject: [PATCH] eeschema: Check connections on current unit This is an expansion of dac12a6d9 that prevents junctions from being added based on the position of alternate units in a component --- eeschema/sch_component.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index d887341dc4..16ac2495bd 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1473,7 +1473,20 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { for( const auto& pin : m_pins ) + { + // Collect only pins attached to the current unit and convert. + // others are not associated to this component instance + int pin_unit = pin.get()->GetLibPin()->GetUnit(); + int pin_convert = pin.get()->GetLibPin()->GetConvert(); + + if( pin_unit > 0 && pin_unit != GetUnit() ) + continue; + + if( pin_convert > 0 && pin_convert != GetConvert() ) + continue; + aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos ); + } } @@ -1737,6 +1750,17 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const for( const auto& pin : m_pins ) { + // Collect only pins attached to the current unit and convert. + // others are not associated to this component instance + int pin_unit = pin.get()->GetLibPin()->GetUnit(); + int pin_convert = pin.get()->GetLibPin()->GetConvert(); + + if( pin_unit > 0 && pin_unit != GetUnit() ) + continue; + + if( pin_convert > 0 && pin_convert != GetConvert() ) + continue; + if( pin->GetPosition() == new_pos ) return true; }