bool ROUTER_TOOL::onViaCommand( VIATYPE_T aType ) { BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); const int layerCount = bds.GetCopperLayerCount(); int currentLayer = m_router->GetCurrentLayer(); PNS_SIZES_SETTINGS sizes = m_router->Sizes(); // fixme: P&S supports more than one fixed layer pair. Update the dialog? sizes.ClearLayerPairs(); sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP, m_frame->GetScreen()->m_Route_Layer_BOTTOM ); if( !m_router->IsPlacingVia() ) { // Cannot place microvias or blind vias if not allowed (obvious) if( ( aType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) ) return false; if( ( aType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) ) return false; //Can only place through vias on 2-layer boards if( ( aType != VIA_THROUGH ) && ( layerCount <= 2 ) ) return false; //Can only place microvias if we're on an outer layer, or directly adjacent to one if( ( aType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount-2 ) ) return false; //Cannot place blind vias with front/back as the layer pair, this doesn't make sense if( ( aType == VIA_BLIND_BURIED ) && ( sizes.GetLayerTop() == F_Cu ) && ( sizes.GetLayerBottom() == B_Cu ) ) return false; } sizes.SetViaType( aType ); if( VIA_MICROVIA == aType ) { sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() ); sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() ); } m_router->UpdateSizes( sizes ); m_router->ToggleViaPlacement(); m_router->Move( m_endSnapPoint, m_endItem ); // refresh return false; }