Fix broken logic in ImportSizes().
Fixes https://gitlab.com/kicad/code/kicad/issues/6049
This commit is contained in:
parent
6ce803b77c
commit
02cbcb99df
|
@ -312,7 +312,7 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem )
|
bool PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth )
|
||||||
{
|
{
|
||||||
VECTOR2I p;
|
VECTOR2I p;
|
||||||
|
|
||||||
|
@ -329,10 +329,11 @@ int PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PNS::ITEM::SEGMENT_T:
|
case PNS::ITEM::SEGMENT_T:
|
||||||
return static_cast<PNS::SEGMENT*>( aItem )->Width();
|
*aInheritedWidth = static_cast<PNS::SEGMENT*>( aItem )->Width();
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PNS::JOINT* jt = static_cast<PNS::NODE*>( aItem->Owner() )->FindJoint( p, aItem );
|
PNS::JOINT* jt = static_cast<PNS::NODE*>( aItem->Owner() )->FindJoint( p, aItem );
|
||||||
|
@ -341,7 +342,6 @@ int PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem )
|
||||||
|
|
||||||
int mval = INT_MAX;
|
int mval = INT_MAX;
|
||||||
|
|
||||||
|
|
||||||
PNS::ITEM_SET linkedSegs = jt->Links();
|
PNS::ITEM_SET linkedSegs = jt->Links();
|
||||||
linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS::ITEM::SEGMENT_T );
|
linkedSegs.ExcludeItem( aItem ).FilterKinds( PNS::ITEM::SEGMENT_T );
|
||||||
|
|
||||||
|
@ -351,7 +351,11 @@ int PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem )
|
||||||
mval = std::min( w, mval );
|
mval = std::min( w, mval );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( mval == INT_MAX ? 0 : mval );
|
if( mval == INT_MAX )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*aInheritedWidth = mval;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,22 +365,24 @@ bool PNS_KICAD_IFACE_BASE::ImportSizes( PNS::SIZES_SETTINGS& aSizes, PNS::ITEM*
|
||||||
PNS::CONSTRAINT constraint;
|
PNS::CONSTRAINT constraint;
|
||||||
|
|
||||||
int trackWidth = bds.m_TrackMinWidth;
|
int trackWidth = bds.m_TrackMinWidth;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
if( bds.m_UseConnectedTrackWidth && aStartItem != nullptr )
|
if( bds.m_UseConnectedTrackWidth && aStartItem != nullptr )
|
||||||
{
|
{
|
||||||
trackWidth = inheritTrackWidth( aStartItem );
|
found = inheritTrackWidth( aStartItem, &trackWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( trackWidth == 0 && bds.UseNetClassTrack() && aStartItem ) // netclass value
|
if( !found && bds.UseNetClassTrack() && aStartItem )
|
||||||
{
|
{
|
||||||
if( m_ruleResolver->QueryConstraint( PNS::CONSTRAINT_TYPE::CT_WIDTH, aStartItem, nullptr,
|
if( m_ruleResolver->QueryConstraint( PNS::CONSTRAINT_TYPE::CT_WIDTH, aStartItem, nullptr,
|
||||||
aStartItem->Layer(), &constraint ) )
|
aStartItem->Layer(), &constraint ) )
|
||||||
{
|
{
|
||||||
trackWidth = constraint.m_Value.OptThenMin();
|
trackWidth = constraint.m_Value.OptThenMin();
|
||||||
|
found = true; // Note: allowed to override anything, including bds.m_TrackMinWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( trackWidth == 0 )
|
if( !found )
|
||||||
{
|
{
|
||||||
trackWidth = bds.GetCurrentTrackWidth();
|
trackWidth = bds.GetCurrentTrackWidth();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
||||||
bool syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB_LAYER_ID aLayer );
|
bool syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB_LAYER_ID aLayer );
|
||||||
bool syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aItem );
|
bool syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aItem );
|
||||||
bool syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, SHAPE_POLY_SET* aBoardOutline );
|
bool syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, SHAPE_POLY_SET* aBoardOutline );
|
||||||
int inheritTrackWidth( PNS::ITEM* aItem );
|
bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );
|
||||||
|
|
||||||
|
|
||||||
PNS::NODE* m_world;
|
PNS::NODE* m_world;
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int inheritTrackWidth( ITEM* aItem );
|
bool inheritTrackWidth( ITEM* aItem, int* aInheritedWidth );
|
||||||
|
|
||||||
int m_trackWidth;
|
int m_trackWidth;
|
||||||
int m_diffPairWidth;
|
int m_diffPairWidth;
|
||||||
|
|
Loading…
Reference in New Issue