/* Build liste conn */ int Build_Work(BOARD * Pcb, CHEVELU* pt_base_chevelu) { int ii; CHEVELU* pt_rats = pt_base_chevelu; D_PAD * pt_pad; int r1,r2, c1,c2, current_net_code; CHEVELU * pt_ch; int demi_pas = pas_route /2; wxString msg; InitWork(); /* clear work list */ Ntotal = 0; for ( ii = Pcb->GetNumRatsnests(); ii > 0 ; ii-- , pt_rats++) { /* On ne route que les chevelus actifs et routables */ if( (pt_rats->status & CH_ACTIF) == 0) continue; if( pt_rats->status & CH_UNROUTABLE) continue; if( (pt_rats->status & CH_ROUTE_REQ) == 0 ) continue; pt_pad = pt_rats->pad_start; current_net_code = pt_pad->m_NetCode; pt_ch = pt_rats; r1 = (pt_pad->m_Pos.y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / pas_route; if( r1 < 0 || r1 >= Nrows) { msg.Printf( wxT("erreur : row = %d ( padY %d pcbY %d) "), r1, pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y); DisplayError(NULL, msg); return(0); } c1 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / pas_route; if( c1 < 0 || c1 >= Ncols) { msg.Printf( wxT("erreur : col = %d ( padX %d pcbX %d) "), c1, pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x); DisplayError(NULL, msg); return(0); } pt_pad = pt_rats->pad_end; r2 = (pt_pad->m_Pos.y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / pas_route; if( r2 < 0 || r2 >= Nrows) { msg.Printf( wxT("erreur : row = %d ( padY %d pcbY %d) "), r2, pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y); DisplayError(NULL, msg); return(0); } c2 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / pas_route; if( c2 < 0 || c2 >= Ncols) { msg.Printf( wxT("erreur : col = %d ( padX %d pcbX %d) "), c2, pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x); DisplayError(NULL, msg); return(0); } SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 ); Ntotal++; } SortWork(); return(Ntotal); }
int Build_Work( BOARD* Pcb ) { RATSNEST_ITEM* pt_rats; D_PAD* pt_pad; int r1, r2, c1, c2, current_net_code; RATSNEST_ITEM* pt_ch; int demi_pas = RoutingMatrix.m_GridRouting / 2; wxString msg; InitWork(); /* clear work list */ int cellCount = 0; for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ ) { pt_rats = &Pcb->m_FullRatsnest[ii]; /* We consider here only ratsnest that are active ( obviously not yet routed) * and routables (that are not yet attempt to be routed and fail */ if( (pt_rats->m_Status & CH_ACTIF) == 0 ) continue; if( pt_rats->m_Status & CH_UNROUTABLE ) continue; if( (pt_rats->m_Status & CH_ROUTE_REQ) == 0 ) continue; pt_pad = pt_rats->m_PadStart; current_net_code = pt_pad->GetNet(); pt_ch = pt_rats; r1 = ( pt_pad->GetPosition().y - RoutingMatrix.m_BrdBox.GetY() + demi_pas ) / RoutingMatrix.m_GridRouting; if( r1 < 0 || r1 >= RoutingMatrix.m_Nrows ) { msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1, pt_pad->GetPosition().y, RoutingMatrix.m_BrdBox.GetY() ); wxMessageBox( msg ); return 0; } c1 = ( pt_pad->GetPosition().x - RoutingMatrix.m_BrdBox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting; if( c1 < 0 || c1 >= RoutingMatrix.m_Ncols ) { msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1, pt_pad->GetPosition().x, RoutingMatrix.m_BrdBox.GetX() ); wxMessageBox( msg ); return 0; } pt_pad = pt_rats->m_PadEnd; r2 = ( pt_pad->GetPosition().y - RoutingMatrix.m_BrdBox.GetY() + demi_pas ) / RoutingMatrix.m_GridRouting; if( r2 < 0 || r2 >= RoutingMatrix.m_Nrows ) { msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2, pt_pad->GetPosition().y, RoutingMatrix.m_BrdBox.GetY() ); wxMessageBox( msg ); return 0; } c2 = ( pt_pad->GetPosition().x - RoutingMatrix.m_BrdBox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting; if( c2 < 0 || c2 >= RoutingMatrix.m_Ncols ) { msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2, pt_pad->GetPosition().x, RoutingMatrix.m_BrdBox.GetX() ); wxMessageBox( msg ); return 0; } SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 ); cellCount++; } SortWork(); return cellCount; }