← Back to team overview

kicad-developers team mailing list archive

Via clearence when routing new track

 

Hi,
I am a new member. This is my first suggestion.
I realize when using another viasize, than netclass
value, it is not possible to see real via clearence value when creating
track. So I suggest this modification. Patch file is in attachment. It
also draws via circle, but it is easy to remove.

Heikki Pulkkinen
=== modified file 'pcbnew/editrack.cpp'
--- pcbnew/editrack.cpp	2012-09-02 16:38:52 +0000
+++ pcbnew/editrack.cpp	2012-11-28 13:16:15 +0000
@@ -652,6 +652,18 @@
 }
 
 
+//+hp: Draws Via circle and Via Clearence circle.
+inline void DrawViaCirclesWhenEditingNewTrack( EDA_RECT* aPanelClipBox,
+wxDC* aDC, const int ax, const int ay, const int aViaRadius, const int
+aViaRadiusWithClearence, EDA_COLOR_T aColor)
+{
+    //Current viasize clearence circle
+    GRCircle( aPanelClipBox, aDC, ax, ay, aViaRadiusWithClearence, aColor );
+    //Current viasize circle
+    GRCircle( aPanelClipBox, aDC, ax, ay, aViaRadius, aColor );
+}
+//+hp
+
 /* Redraw the current track being created when the mouse cursor is moved
  */
 void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
@@ -674,6 +686,12 @@
     if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
         DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
 
+    //+hp: Values to Via circle
+    int boardViaRadius=frame->GetBoard()->GetCurrentViaSize()/2;
+    int viaRadiusWithClearence=boardViaRadius+netclass->GetClearance();
+    EDA_RECT* panelClipBox=aPanel->GetClipBox();
+    //+hp
+
 #ifndef USE_WX_OVERLAY
     // Erase old track
     if( aErase )
@@ -686,10 +704,10 @@
         {
             EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );
 
-            GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x,
-                      g_CurrentTrackSegment->m_End.y,
-                      ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
-                      color );
+            //+hp:
+            //Via diameter must have taken what we are using rather,than netclass value.
+            DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End.x, g_CurrentTrackSegment->m_End.y, boardViaRadius, viaRadiusWithClearence, color);
+            //+hp
         }
     }
 #endif
@@ -754,10 +772,10 @@
     {
         EDA_COLOR_T color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
 
-        GRCircle( aPanel->GetClipBox(), aDC, g_CurrentTrackSegment->m_End.x,
-                  g_CurrentTrackSegment->m_End.y,
-                  ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
-                  color );
+        //+hp:
+        //Via diameter must have taken what we are using, rather than netclass value.
+        DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->m_End.x, g_CurrentTrackSegment->m_End.y, boardViaRadius, viaRadiusWithClearence, color);
+        //+hp
     }
 
     /* Display info about current segment and the full new track: