fixed problem when trying to place a micro via
This commit is contained in:
parent
f3278c1652
commit
6909843938
|
@ -342,7 +342,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_PCB_PLACE_MICROVIA:
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
||||||
if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
|
if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_PLACE_VIA:
|
case ID_POPUP_PCB_PLACE_VIA:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
if( GetCurItem()->m_Flags & IS_DRAGGED )
|
||||||
|
|
|
@ -184,54 +184,55 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
via->m_Width = GetBoard()->GetCurrentViaSize();
|
via->m_Width = GetBoard()->GetCurrentViaSize();
|
||||||
via->SetNet( g_HighLight_NetCode );
|
via->SetNet( g_HighLight_NetCode );
|
||||||
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
||||||
int old_layer = getActiveLayer();
|
// Usual via is from copper to component.
|
||||||
|
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
|
||||||
|
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
||||||
|
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
|
||||||
|
|
||||||
// swap the layers.
|
int first_layer = getActiveLayer();
|
||||||
if( getActiveLayer() !=
|
int last_layer;
|
||||||
((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
// prepare switch to new active layer:
|
||||||
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP );
|
if( first_layer != GetScreen()->m_Route_Layer_TOP )
|
||||||
|
last_layer = GetScreen()->m_Route_Layer_TOP;
|
||||||
else
|
else
|
||||||
setActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
|
last_layer = GetScreen()->m_Route_Layer_BOTTOM;
|
||||||
|
|
||||||
/* Adjust the via layer pair */
|
/* Adjust the actual via layer pair */
|
||||||
switch ( via->Shape() )
|
switch ( via->Shape() )
|
||||||
{
|
{
|
||||||
case VIA_BLIND_BURIED:
|
case VIA_BLIND_BURIED:
|
||||||
via->SetLayerPair( old_layer, getActiveLayer() );
|
via->SetLayerPair( first_layer, last_layer );
|
||||||
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIA_MICROVIA: // from external to the near neighbor inner layer
|
case VIA_MICROVIA: // from external to the near neighbor inner layer
|
||||||
if ( old_layer == LAYER_N_BACK )
|
{
|
||||||
setActiveLayer( LAYER_N_2 );
|
int last_inner_layer = GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2;
|
||||||
else if ( old_layer == LAYER_N_FRONT )
|
if ( first_layer == LAYER_N_BACK )
|
||||||
setActiveLayer( GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2 );
|
last_layer = LAYER_N_2;
|
||||||
else if ( old_layer == LAYER_N_2 )
|
else if ( first_layer == LAYER_N_FRONT )
|
||||||
setActiveLayer( LAYER_N_BACK );
|
last_layer = last_inner_layer;
|
||||||
else if ( old_layer == GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2 );
|
else if ( first_layer == LAYER_N_2 )
|
||||||
setActiveLayer( LAYER_N_FRONT );
|
last_layer = LAYER_N_BACK;
|
||||||
// else error
|
else if ( first_layer == last_inner_layer )
|
||||||
via->SetLayerPair( old_layer, getActiveLayer() );
|
last_layer = LAYER_N_FRONT;
|
||||||
|
// else error: will be removed later
|
||||||
|
via->SetLayerPair( first_layer, last_layer );
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net = GetBoard()->FindNet( via->GetNet() );
|
NETINFO_ITEM* net = GetBoard()->FindNet( via->GetNet() );
|
||||||
via->m_Width = net->GetMicroViaSize();
|
via->m_Width = net->GetMicroViaSize();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Usual via is from copper to component; layer pair is 0 and 0x0F.
|
|
||||||
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
|
|
||||||
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Drc_On && BAD_DRC==m_drc->Drc( via, GetBoard()->m_Track ) )
|
if( Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) )
|
||||||
{
|
{
|
||||||
/* DRC fault: the Via cannot be placed here ... */
|
/* DRC fault: the Via cannot be placed here ... */
|
||||||
delete via;
|
delete via;
|
||||||
|
|
||||||
setActiveLayer( old_layer );
|
|
||||||
|
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
|
|
||||||
// delete the track(s) added in Begin_Route()
|
// delete the track(s) added in Begin_Route()
|
||||||
|
@ -248,6 +249,8 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActiveLayer( last_layer );
|
||||||
|
|
||||||
TRACK* lastNonVia = g_CurrentTrackSegment;
|
TRACK* lastNonVia = g_CurrentTrackSegment;
|
||||||
|
|
||||||
/* A new via was created. It was Ok.
|
/* A new via was created. It was Ok.
|
||||||
|
|
Loading…
Reference in New Issue