← Back to team overview

kicad-developers team mailing list archive

Simplified vias patch proposal

 

Hello kicad developers :)

First of all, thanks everyone for this great software !

I had quite a hard time moving from protel (mainly getting used to the 
keyboard shortcuts and the menus organization), it is difficult to 
forget the software you used to learn routing :)

Anyway, I am currently designing an open source 300W DC motor controller 
and I need a huge amount of vias to handle the current flow from the top layer 
where my MOSFET transistors are installed to the bottom and its huge GND zone. 

I didn't find an easy way to manually place vias without drawing tracks 
going from one layer to the other every 10 milimeters. I tried but it 
was way too slow (and boring !) and gave impredictable results (the vias 
were not always snapped on the grid the way I wanted to).

As I have a lot of zones (insted of tracks) on my design, I had to find 
a way to place vias all around my zones and in some specific locations 
such as around my transistors pads.

So, with a friend (xavierg, in cc) we patched the last version of the 
testing branch to add a friendly "place-via" button.

It is quite a trivial patch as it calls the functions from 
hotkeys_board_editor.cpp just as if I was doing the job by hand.

I would like to have some feedbacks on this patch, to know if we did it 
right or if we missed something important.

I am also thinking of adding a feature directly in the zones creation 
dialogue to automatically add vias in the zone following specific 
patterns (grid, lines, tied to the zone borders etc).

What do you guys think ? Please let us know.

Cheers !

Samuel Lesueur
=== modified file 'bitmaps_png/CMakeLists.txt'
--- bitmaps_png/CMakeLists.txt	2012-06-20 09:57:36 +0000
+++ bitmaps_png/CMakeLists.txt	2012-06-24 10:22:17 +0000
@@ -136,6 +136,7 @@
     add_rectangle
     add_text
     add_tracks
+    add_vias
     add_zone_cutout
     add_zone
     anchor

=== added file 'bitmaps_png/cpp_26/add_vias.cpp'
--- bitmaps_png/cpp_26/add_vias.cpp	1970-01-01 00:00:00 +0000
+++ bitmaps_png/cpp_26/add_vias.cpp	2012-06-24 10:46:25 +0000
@@ -0,0 +1,57 @@
+
+/* Do not modify this file, it was automatically generated by the
+ * PNG2cpp CMake script, using a *.png file as input.
+ */
+
+#include <bitmaps.h>
+
+static const unsigned char png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0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0x39, 0x00, 0x74, 0x03, 0x71, 0x59, 0x36, 0xb5, 0xea,
+ 0x86, 0x95, 0xf7, 0x57, 0x03, 0x90, 0x02, 0xb6, 0x74, 0xb8, 0xdd, 0x87, 0xf6, 0x06, 0x02, 0xe3,
+ 0xdd, 0x1e, 0xcf, 0x58, 0x83, 0xaa, 0x9e, 0x93, 0xe2, 0x8f, 0x00, 0xfb, 0x80, 0x2e, 0xa9, 0x8d,
+ 0x17, 0xb0, 0x57, 0xdd, 0xb0, 0xe6, 0x12, 0x4a, 0x58, 0x54, 0x76, 0x7e, 0xb7, 0x14, 0x7c, 0x8f,
+ 0xfc, 0x6e, 0x95, 0xfe, 0xa8, 0x5c, 0x67, 0x5f, 0xf2, 0x5d, 0xb7, 0x20, 0x33, 0x17, 0xe0, 0x07,
+ 0xd6, 0x01, 0xad, 0xf2, 0x08, 0x27, 0x81, 0x90, 0xf4, 0xbb, 0xe4, 0x3a, 0xa5, 0xa6, 0x31, 0x21,
+ 0x35, 0xab, 0x93, 0x1d, 0xef, 0x92, 0xfa, 0xb9, 0xe4, 0x7f, 0x5d, 0x79, 0x2e, 0xfd, 0x95, 0x09,
+ 0x6b, 0x1a, 0x7e, 0x8a, 0x79, 0xe0, 0x55, 0x33, 0xf4, 0x96, 0x1f, 0x27, 0x35, 0xd9, 0x0f, 0x18,
+ 0xb1, 0xa8, 0xdb, 0xd2, 0xdc, 0x15, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
+ 0x42, 0x60, 0x82,
+};
+
+const BITMAP_OPAQUE add_vias_xpm[1] = {{ png, sizeof( png ), "add_vias_xpm" }};
+
+//EOF

=== added file 'bitmaps_png/sources/add_vias.svg'
--- bitmaps_png/sources/add_vias.svg	1970-01-01 00:00:00 +0000
+++ bitmaps_png/sources/add_vias.svg	2012-06-24 10:16:41 +0000
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   height="48"
+   width="48"
+   version="1.1"
+   id="svg2"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="add_tracks_and_vias.svg">
+  <metadata
+     id="metadata42">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1053"
+     inkscape:window-height="755"
+     id="namedview40"
+     showgrid="false"
+     inkscape:zoom="9.8333333"
+     inkscape:cx="19.945906"
+     inkscape:cy="29.482519"
+     inkscape:window-x="764"
+     inkscape:window-y="259"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs4">
+    <filter
+       id="c"
+       height="1.3651"
+       width="1.2097"
+       color-interpolation-filters="sRGB"
+       y="-.18257"
+       x="-.10484">
+      <feGaussianBlur
+         stdDeviation="1.5978799"
+         id="feGaussianBlur7" />
+    </filter>
+    <filter
+       id="d"
+       height="1.4696"
+       width="1.481"
+       color-interpolation-filters="sRGB"
+       y="-.23482"
+       x="-.24049">
+      <feGaussianBlur
+         stdDeviation="1.5978799"
+         id="feGaussianBlur10" />
+    </filter>
+  </defs>
+  <g
+     transform="matrix(2.4566,0,0,2.2316,-37.589,-39.022)"
+     id="g12">
+    <rect
+       fill-opacity="0"
+       height="16"
+       width="16"
+       y="0"
+       x="0"
+       id="rect14" />
+  </g>
+  <g
+     transform="matrix(2.9379,0,0,2.1996,3.2038,3.4368)"
+     id="g16">
+    <rect
+       fill-opacity="0"
+       height="16"
+       width="16"
+       y="0"
+       x="0"
+       id="rect18" />
+  </g>
+  <g
+     transform="matrix(3.433,0,0,3.1874,36.579,24.886)"
+     id="g20">
+    <path
+       fill="#afaf00"
+       d="m12 5.5-2.5174-1.3495-2.5388 1.3087 0.5056-2.8112-2.0292-2.0101 2.8298-0.3879 1.2847-2.551 1.2433 2.5714 2.823 0.43352-2.061 1.9771z"
+       transform="matrix(.86499 0 0 .86499 3.3638 -4.5167)"
+       id="path22" />
+    <path
+       fill="#ebeb00"
+       d="m12 5.5-2.5174-1.3495-2.5388 1.3087 0.5056-2.8112-2.0292-2.0101 2.8298-0.3879 1.2847-2.551 1.2433 2.5714 2.823 0.43352-2.061 1.9771z"
+       transform="matrix(.61624 0 0 .61624 5.7296 -4.1188)"
+       id="path24" />
+    <path
+       fill="#ff0"
+       d="m12 5.5-2.5174-1.3495-2.5388 1.3087 0.5056-2.8112-2.0292-2.0101 2.8298-0.3879 1.2847-2.551 1.2433 2.5714 2.823 0.43352-2.061 1.9771z"
+       transform="matrix(.3815 0 0 .3815 7.9622 -3.7434)"
+       id="path26" />
+  </g>
+  <g
+     transform="matrix(1.4445562,0,0,1.3565374,47.603229,-5.3893989)"
+     id="g34">
+    <path
+       d="m -15.677,14.571 c -4.4012,0 -7.9732,3.6582 -7.9732,8.1655 0,4.5074 3.572,8.1655 7.9732,8.1655 4.4012,0 7.9732,-3.6582 7.9732,-8.1655 0,-4.5074 -3.572,-8.1655 -7.9732,-8.1655 z m 0,4.666 c 1.8862,0 3.4171,1.5678 3.4171,3.4995 0,1.9317 -1.5309,3.4995 -3.4171,3.4995 -1.8862,0 -3.4171,-1.5678 -3.4171,-3.4995 0,-1.9317 1.5309,-3.4995 3.4171,-3.4995 z"
+       id="path36"
+       inkscape:connector-curvature="0"
+       style="opacity:0.71094001;filter:url(#d)" />
+    <path
+       d="m -17.955,12.638 c -4.4012,0 -7.9732,3.6582 -7.9732,8.1655 0,4.5074 3.572,8.1655 7.9732,8.1655 4.4012,0 7.9732,-3.6582 7.9732,-8.1655 0,-4.5074 -3.572,-8.1655 -7.9732,-8.1655 z m 0,4.666 c 1.8862,0 3.4171,1.5678 3.4171,3.4995 0,1.9317 -1.5309,3.4995 -3.4171,3.4995 -1.8862,0 -3.4171,-1.5678 -3.4171,-3.4995 0,-1.9317 1.5309,-3.4995 3.4171,-3.4995 z"
+       id="path38"
+       inkscape:connector-curvature="0"
+       style="fill:#d72e2e" />
+  </g>
+</svg>

=== modified file 'include/bitmaps.h'
--- include/bitmaps.h	2012-06-20 09:57:36 +0000
+++ include/bitmaps.h	2012-06-24 10:17:54 +0000
@@ -71,6 +71,7 @@
 EXTERN_BITMAP( add_rectangle_xpm )
 EXTERN_BITMAP( add_text_xpm )
 EXTERN_BITMAP( add_tracks_xpm )
+EXTERN_BITMAP( add_vias_xpm )
 EXTERN_BITMAP( add_zone_cutout_xpm )
 EXTERN_BITMAP( add_zone_xpm )
 EXTERN_BITMAP( icon_pcbnew_xpm )

=== modified file 'pcbnew/edit.cpp'
--- pcbnew/edit.cpp	2012-06-08 09:56:42 +0000
+++ pcbnew/edit.cpp	2012-06-24 09:36:35 +0000
@@ -1319,6 +1319,12 @@
         }
 
         break;
+    case ID_TRACKVIA_BUTT:
+        if( Drc_On )
+            SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
+        else
+            SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
+        break;
 
     case ID_PCB_MODULE_BUTT:
         SetToolID( id, wxCURSOR_PENCIL, _( "Add module" ) );

=== modified file 'pcbnew/onleftclick.cpp'
--- pcbnew/onleftclick.cpp	2012-06-17 16:06:12 +0000
+++ pcbnew/onleftclick.cpp	2012-06-24 10:50:30 +0000
@@ -290,6 +290,24 @@
 
         break;
 
+    case ID_TRACKVIA_BUTT: {
+        //first, we want to know the layer we are working on
+        int current_layer;
+        current_layer = getActiveLayer();
+        // begin drawing a new track
+        DrawStruct = (BOARD_ITEM*) Begin_Route( NULL, aDC );
+        SetCurItem( DrawStruct );
+        // trigger the event to place a via (code copied from hotkeys_board_editor.cpp)
+        wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
+        evt.SetEventObject( this );
+        evt.SetId( ID_POPUP_PCB_PLACE_VIA );
+        GetEventHandler()->ProcessEvent( evt );
+        // end the track drawing
+        End_Route( (TRACK*) DrawStruct, aDC );
+        //then we change the active layer again :)
+        SwitchLayer( aDC, current_layer );
+        break;
+    }
     case ID_PCB_ZONES_BUTT:
 
         /* ZONE Tool is selected. Determine action for a left click:

=== modified file 'pcbnew/pcbnew_id.h'
--- pcbnew/pcbnew_id.h	2012-06-04 19:04:12 +0000
+++ pcbnew/pcbnew_id.h	2012-06-24 09:36:35 +0000
@@ -25,6 +25,7 @@
     ID_PCB_SHOW_1_RATSNEST_BUTT,
     ID_PCB_MODULE_BUTT,
     ID_TRACK_BUTT,
+    ID_TRACKVIA_BUTT,
     ID_PCB_ZONES_BUTT,
     ID_PCB_ADD_LINE_BUTT,
     ID_PCB_CIRCLE_BUTT,

=== modified file 'pcbnew/tool_pcb.cpp'
--- pcbnew/tool_pcb.cpp	2012-06-08 09:56:42 +0000
+++ pcbnew/tool_pcb.cpp	2012-06-24 10:20:49 +0000
@@ -426,6 +426,9 @@
     m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiBitmap( add_tracks_xpm ),
                             _( "Add tracks and vias" ), wxITEM_CHECK );
 
+    m_drawToolBar->AddTool( ID_TRACKVIA_BUTT, wxEmptyString, KiBitmap( add_vias_xpm ),
+                            _( "Add vias" ), wxITEM_CHECK );
+
     m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiBitmap( add_zone_xpm ),
                             _( "Add filled zones" ), wxITEM_CHECK );
 

Attachment: signature.asc
Description: Digital signature


Follow ups