Don't require keepout zones to be named.
insideArea() now takes A, B, a UUID or a zone name. (Only the UUID is new.)
This commit is contained in:
parent
be0de8d151
commit
8c93fc76ae
|
@ -111,6 +111,9 @@ bool KIID::SniffTest( const wxString& aCandidate )
|
||||||
if( c >= 'A' && c <= 'F' )
|
if( c >= 'A' && c <= 'F' )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( c == '-' )
|
||||||
|
continue;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,18 +377,21 @@ void DRC_ENGINE::loadImplicitRules()
|
||||||
|
|
||||||
for( ZONE_CONTAINER* zone : keepoutZones )
|
for( ZONE_CONTAINER* zone : keepoutZones )
|
||||||
{
|
{
|
||||||
if( zone->GetZoneName().IsEmpty() )
|
|
||||||
zone->SetZoneName( KIID().AsString() );
|
|
||||||
|
|
||||||
wxString name = zone->GetZoneName();
|
wxString name = zone->GetZoneName();
|
||||||
|
|
||||||
if( KIID::SniffTest( name ) ) // Synthetic name; don't show to user
|
if( name.IsEmpty() )
|
||||||
|
{
|
||||||
rule = createImplicitRule( _( "keepout area" ) );
|
rule = createImplicitRule( _( "keepout area" ) );
|
||||||
|
name = zone->m_Uuid.AsString();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rule = createImplicitRule( wxString::Format( _( "keepout area '%s'" ), name ) );
|
rule = createImplicitRule( wxString::Format( _( "keepout area '%s'" ), name ) );
|
||||||
|
}
|
||||||
|
|
||||||
rule->m_Condition = new DRC_RULE_CONDITION( wxString::Format( "A.insideArea('%s')",
|
rule->m_Condition = new DRC_RULE_CONDITION( wxString::Format( "A.insideArea('%s')",
|
||||||
zone->GetZoneName() ) );
|
name ) );
|
||||||
|
|
||||||
if( zone->GetDoNotAllowTracks() )
|
if( zone->GetDoNotAllowTracks() )
|
||||||
addKeepoutConstraint( DRC_DISALLOW_TRACKS );
|
addKeepoutConstraint( DRC_DISALLOW_TRACKS );
|
||||||
|
|
||||||
|
|
|
@ -305,10 +305,59 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
if( insideZone( dynamic_cast<ZONE_CONTAINER*>( context->GetItem( 1 ) ) ) )
|
if( insideZone( dynamic_cast<ZONE_CONTAINER*>( context->GetItem( 1 ) ) ) )
|
||||||
result->Set( 1.0 );
|
result->Set( 1.0 );
|
||||||
}
|
}
|
||||||
else
|
else if( KIID::SniffTest( arg->AsString() ) )
|
||||||
|
{
|
||||||
|
KIID target( arg->AsString() );
|
||||||
|
|
||||||
|
for( ZONE_CONTAINER* candidate : item->GetBoard()->Zones() )
|
||||||
|
{
|
||||||
|
// Only a single zone can match the UUID; exit once we find a match whether
|
||||||
|
// "inside" or not
|
||||||
|
if( candidate->m_Uuid == target )
|
||||||
|
{
|
||||||
|
if( insideZone( candidate ) )
|
||||||
|
result->Set( 1.0 );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( MODULE* module : item->GetBoard()->Modules() )
|
||||||
|
{
|
||||||
|
for( ZONE_CONTAINER* candidate : module->Zones() )
|
||||||
|
{
|
||||||
|
// Only a single zone can match the UUID; exit once we find a match whether
|
||||||
|
// "inside" or not
|
||||||
|
if( candidate->m_Uuid == target )
|
||||||
|
{
|
||||||
|
if( insideZone( candidate ) )
|
||||||
|
result->Set( 1.0 );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Match on zone name
|
||||||
{
|
{
|
||||||
for( ZONE_CONTAINER* candidate : item->GetBoard()->Zones() )
|
for( ZONE_CONTAINER* candidate : item->GetBoard()->Zones() )
|
||||||
{
|
{
|
||||||
|
if( candidate->GetZoneName().Matches( arg->AsString() ) )
|
||||||
|
{
|
||||||
|
// Many zones can match the name; exit only when we find an "inside"
|
||||||
|
if( insideZone( candidate ) )
|
||||||
|
{
|
||||||
|
result->Set( 1.0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( MODULE* module : item->GetBoard()->Modules() )
|
||||||
|
{
|
||||||
|
for( ZONE_CONTAINER* candidate : module->Zones() )
|
||||||
|
{
|
||||||
|
// Many zones can match the name; exit only when we find an "inside"
|
||||||
if( candidate->GetZoneName().Matches( arg->AsString() ) )
|
if( candidate->GetZoneName().Matches( arg->AsString() ) )
|
||||||
{
|
{
|
||||||
if( insideZone( candidate ) )
|
if( insideZone( candidate ) )
|
||||||
|
@ -320,6 +369,7 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void memberOf( LIBEVAL::CONTEXT* aCtx, void* self )
|
static void memberOf( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
|
|
Loading…
Reference in New Issue