kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #29992
Re: [PATCH] More aggressive sheet-selection
I fixed up some of the code violations I could see, and applied the
patch to current master, where the sheet selection is working once again.
- Kristoffer
On 07/12/2017 10:01 PM, Kristoffer Ödmark wrote:
The last working revision I copuld test was:
2c21c70f46dd3ef444ac4a909434697cce972f4a
Right before the new connectivty algorithm.
After that the sheet-selection is not working anymore. So It would be
nice if you could file a bug report on it :)
- Kristoffer
On 2017-07-12 13:33, Kristoffer Ödmark wrote:
No worries!
As an example, If i layout a group of components, all which require
the powerpaths as in they need acess to 3v3 lines that are used in
other areas of the board as well. These 3v3 lines might be a bit
annoying to route for certain cases.
As the code is now, since these 3v3 lines are used as an outside
connection of the sheet, they will be ignored, even if they only connect
between pads on the same subschematic. Say that the connection to the
global 3v3 net is handled later with a via or something like that.
The same logic applies to all pins that connect outside the block, and
in some cases the layout of the blocks have a non-trivial routing to
get the signal out of the block "area", which is what i noticed when
using these. Hope this explanation made it more clear
With this more aggressive change. It is also more visible from the pcb
side to where this "block" has dependencies, I also find it easier to
deselect segments manually, than to select them if the block is not
very trivial.
Regarding the code violations, I will have a look later when I get the
time as well.
the GND thing must indeed be a bug, which I will look into as well.
On 07/12/2017 10:30 AM, Maciej Sumiński wrote:
Hi Kristoffer,
I apologize for such a long delay. Finally I had to time to look at the
patch. I tried it out with a few boards, but I could not really notice a
difference. I read the code and I think I understand what are you trying
to do, but are you sure it is the right way to go? Hierarchical sheets
are frequently used as rooms/channels/duplicated blocks and in my
opinion selecting items belonging to a sheet should be restricted to
items unique to the sheet. Would you give a use case where the new
behavior gives benefits?
Please pay attention to the code formatting, I see a number of
violations there.
Also, I observed a bug when selecting items belonging to the same sheet.
If you open complex_hierarchy demo and use the select action on P3 or
P5, you will notice that all components with a pad connected to GND are
also selected. I can create a bug report if necessary.
Regards,
Orson
On 07/11/2017 05:36 PM, Kristoffer Ödmark wrote:
Well, the sheet-selection code was all submitted by me in the first
place, It doesnt exist in legacy, so this change to how it works is
according to me more inline with what I wanted in the beginning :)
- Kristoffer
On 2017-07-10 21:06, Wayne Stambaugh wrote:
Kristoffer,
This appears to only effect the GAL canvases. Would one of our
resident
tool framework experts please take a look at this an see if it makes
sense? If no one has time, I will try to get to it by this
weekend. It
will take most of the week for me to recover from vacation before I
can
take a look at it.
Thanks,
Wayne
On 7/10/2017 11:21 AM, Kristoffer Ödmark wrote:
Hello!
Second bump, I guess I might be the only one who uses the
sheet-selection then :) My suggestion is to merge this patch in, It
makes the selection more much more useful!
- Kristoffer
On 2017-06-06 13:44, Kristoffer Ödmark wrote:
Hello again!
I understand that everyone is pretty busy, but I would appreciate if
someone took a quick glance at this and said what they think.
- Kristoffer
On 2017-05-03 15:51, Kristoffer Ödmark wrote:
Hello everyone!
I made a small change to the "select hierarchical sheet"
function. I
would love if someone tried this and gave some feedback.
Before the function only selected segments belonging to a netlist
unique to that hierarchical sheet. Now it will use the "select
logical connection" to every segment connected to module from the
subsheet as well. presonally I think it is more useful now, but I
want confirmation if possible :)
- Kristoffer
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
--
-Kristoffer
>From aeb9722cfb42ef30e75a98c388d7b42385a6ec65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= <kristoffer.odmark90@xxxxxxxxx>
Date: Mon, 17 Jul 2017 14:55:31 +0200
Subject: [PATCH] Heirarchical sheet selection includes more.
Now the heirarchical sheet selection feature includes tracks that belong
to a net spanning multiple sheets, but only by doing a logical connection
from the pads of the modules. This is to be able to select connections
between components on the same sheet. For example if the sheet contains a
star power connection or something similar, then most of the sheet local
connections will now also be included.
---
pcbnew/class_board.cpp | 16 ++++++++++++++++
pcbnew/class_board.h | 10 ++++++++++
pcbnew/class_track.h | 11 +++++++++++
pcbnew/tools/selection_tool.cpp | 14 +++++++++++++-
4 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index 835ac9c73..3ecf48a0e 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -32,6 +32,7 @@
#include <limits.h>
#include <algorithm>
+#include <iterator>
#include <fctsys.h>
#include <common.h>
@@ -1589,6 +1590,21 @@ VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer) con
}
return NULL;
+
+}
+
+std::list<TRACK*> BOARD::GetTracksByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer ) const
+{
+ std::list<TRACK*> tracks;
+ for( TRACK *track = GetFirstTrack( m_Track); track; track = GetFirstTrack( track->Next() ) )
+ {
+ if( ( ( track->GetStart() == aPosition) || track->GetEnd() == aPosition ) &&
+ ( track->GetState( BUSY | IS_DELETED ) == 0 ) &&
+ ( ( aLayer == UNDEFINED_LAYER ) || ( track->IsOnLayer( aLayer ) ) ) )
+
+ tracks.push_back( track );
+ }
+ return tracks;
}
diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h
index 8f1eca48e..c3d0f3218 100644
--- a/pcbnew/class_board.h
+++ b/pcbnew/class_board.h
@@ -1166,6 +1166,16 @@ public:
PCB_LAYER_ID aLayer = PCB_LAYER_ID( -1 ) ) const;
/**
+ * Function GetTracksByPosition
+ * finds the list of tracks that starts or ends at \a aPosition on \a aLayer.
+ *
+ * @param aPosition The wxPoint to check start agains against.
+ * @param aLayer The layer to search. Use -1 (<PCB_LAYER_ID>::UNDEFINED_LAYER) for a don't care.
+ * @return std::list<TRACK*> A list of TRACK* items that can be zero if no track is found.
+ */
+ std::list<TRACK*> GetTracksByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer = PCB_LAYER_ID( -1 ) ) const;
+
+ /**
* Function GetPad
* finds a pad \a aPosition on \a aLayer.
*
diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h
index 7b4602e53..2e8071426 100644
--- a/pcbnew/class_track.h
+++ b/pcbnew/class_track.h
@@ -498,5 +498,16 @@ inline VIA* GetFirstVia( TRACK* aTrk, const TRACK* aStopPoint = NULL )
else
return NULL;
}
+inline TRACK* GetFirstTrack( TRACK* aTrk, const TRACK* aStopPoint = NULL )
+{
+ while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) )
+ aTrk = aTrk->Next();
+
+ // It could stop because of the stop point, not on a via
+ if( aTrk && ( aTrk->Type() == PCB_TRACE_T ) )
+ return static_cast<TRACK*>( aTrk );
+ else
+ return NULL;
+}
#endif // CLASS_TRACK_H
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index 1d73d25fe..eb2c84dd7 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -897,6 +897,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
//Generate a list of all pads, and of all nets they belong to.
std::list<int> netcodeList;
+ std::list<BOARD_CONNECTED_ITEM*> padList;
for( MODULE* mmod : modList )
{
for( auto pad : mmod->Pads() )
@@ -904,14 +905,25 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
if( pad->IsConnected() )
{
netcodeList.push_back( pad->GetNetCode() );
+ padList.push_back( pad );
}
}
}
-
// remove all duplicates
netcodeList.sort();
netcodeList.unique();
+ // auto select trivial connections segments which are launched from the pads
+ std::list<TRACK*> launchTracks;
+ for( auto pad : padList )
+ {
+ launchTracks = board()->GetTracksByPosition( pad->GetPosition() );
+ for ( auto track : launchTracks )
+ {
+ selectAllItemsConnectedToTrack( *track );
+ }
+ }
+
// now we need to find all modules that are connected to each of these nets
// then we need to determine if these modules are in the list of modules
// belonging to this sheet ( modList )
--
2.13.2
Follow ups
References