Exemplo n.º 1
0
/* Main cleaning function.
 *  Delete
 * - Redundant points on tracks (merge aligned segments)
 * - vias on pad
 * - null lenght segments
 *  Create segments when track ends are incorrectly connected:
 *  i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
 */
bool TRACKS_CLEANER::CleanupBoard( PCB_EDIT_FRAME *aFrame,
                                   bool aCleanVias,
                                   bool aMergeSegments,
                                   bool aDeleteUnconnected )
{
    bool modified = false;

    // delete redundant vias
    modified |= (aCleanVias && clean_vias());

    // Remove null segments and intermediate points on aligned segments
    modified |= (aMergeSegments && clean_segments());

    // Delete dangling tracks
    modified |= (aDeleteUnconnected && deleteUnconnectedTracks());

    if( modified )
    {
        // Clear undo and redo lists to avoid inconsistencies between lists
        // XXX This is very involved... maybe a member in PCB_EDIT_FRAME
        // would be better?
        aFrame->GetScreen()->ClearUndoRedoList();
        aFrame->SetCurItem( NULL );
        aFrame->Compile_Ratsnest( NULL, true );
        aFrame->OnModify();
    }
    return modified;
}
Exemplo n.º 2
0
/* Main cleaning function.
 *  Delete
 * - Redundant points on tracks (merge aligned segments)
 * - vias on pad
 * - null length segments
 *  Create segments when track ends are incorrectly connected:
 *  i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
 */
bool TRACKS_CLEANER::CleanupBoard( PCB_EDIT_FRAME *aFrame,
                                   bool aCleanVias,
                                   bool aMergeSegments,
                                   bool aDeleteUnconnected )
{
    bool modified = false;

    // delete redundant vias
    modified |= (aCleanVias && clean_vias());

    // Remove null segments and intermediate points on aligned segments
    modified |= (aMergeSegments && clean_segments());

    // Delete dangling tracks
    if( aDeleteUnconnected && deleteUnconnectedTracks() )
    {
        modified = true ;

        // Removed tracks can leave aligned segments
        // (when a T was formed by tracks and the "vertical" segment
        // is removed;
        if( aMergeSegments )
            clean_segments();
    }

    if( modified )
    {
        // Clear undo and redo lists to avoid inconsistencies between lists
        aFrame->GetScreen()->ClearUndoRedoList();
        aFrame->SetCurItem( NULL );
        aFrame->Compile_Ratsnest( NULL, true );
        aFrame->OnModify();
    }

    return modified;
}
Exemplo n.º 3
0
/* Main cleaning function.
 *  Delete
 * - Redundant points on tracks (merge aligned segments)
 * - vias on pad
 * - null lenght segments
 *  Create segments when track ends are incorrectly connected:
 *  i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
 */
bool TRACKS_CLEANER::CleanupBoard()
{
    bool modified = false;

    // delete redundant vias
    if( m_cleanVias && clean_vias() )
        modified = true;

    // Remove null segments and intermediate points on aligned segments
    if( m_mergeSegments && clean_segments() )
        modified = true;

    // Delete dangling tracks
    if( m_deleteUnconnectedTracks && deleteUnconnectedTracks() )
        modified = true;

    return modified;
}