Hi Tom, Was a great catch up with the developers in Spain.
Thanks for prompting me about the below email and branch. I will get this and look at it during this week and attempt to add the algorithm there. Talk soon. Regards Stuart Get BlueMail for Android On 24 July 2023, 4:40 pm, at 4:40 pm, Tomasz Wlostowski <[email protected]> wrote: >On 18/07/2023 20:06, Stuart Tyler wrote: >> Hi Jon, >> >> Thanks for the feedback. Yes, I agree with all your points. I started > >> off copying drag track but backed out of this as I got stuck >accessing >> the multiple selections, but totally agree with your points. >> >> I have not looked through the component dragger as yet and will visit > >> that over the next couple of days. I think your comparison is correct >- >> I will attempt to follow its track movement and addition style - I >now >> understand the algorithm and what is needed at least. >> >> Appreciate the pointer to looking at component dragger. >> >Hi Stuart, > >I encourage you to have a look at this branch: >https://gitlab.com/twlostow/kicad/-/commits/tom-multidrag-demo-clean > >It contains a very shitty multi-drag algorithm - but my intention there > >was not to develop one, but to show how I would see it integrated in >the >router & tool stack of pcbnew. I hope you can build a decent >multi-trace >dragger on top of this code. > >I'll be happy to answer any questions you might have, but be prepared >for some delay with responses. > >Regards, >Tom > > > >> Regards >> Stuart Tyler >> >> >> >> Jon Evans wrote: >> >> >>> Hi Stuart, >>> >>> Some general comments on this project: >>> >>> 1) This functionality should be built into the router, not into the >>> edit routines outside the router IMO. So this should be implemented > >>> as part of DRAGGER probably. If you look at how the rest of the >>> router works, you should be able to re-use all its functionality for > >>> creating and modifying items in the board. >>> >>> 2) The functionality you're looking for is at some level similar to >>> the work that is done by the PNS component dragger (since it has to >be >>> able to reroute multiple different tracks), so you might get some >>> additional hints from that class. >>> >>> 3) There is no need for a new action / hotkey. The existing actions > >>> should be able to handle single-track vs multi-track dragging based >on >>> what the selection contains. >>> >>> Best, >>> Jon >>> >>> On Tue, Jul 18, 2023 at 1:44 PM Stuart Tyler ><[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> Hi, I have tried to add a track, but its not appearing on the >board. >>> Here is my code in my code that does the track add. Is in >>> edit_tool_move_fct.cpp (1259) >>> >>> >>> printf( "*** Adding new track to board >>> ***\r\n" ); >>> std::vector<BOARD_ITEM*> bulkAddedItems; >>> PCB_TRACK* pcbTrackOfItem = >>> dynamic_cast<PCB_TRACK*>( item ); >>> auto newTrack = new PCB_TRACK( >>> pcbTrackOfItem ); >>> BOARD_ITEM* newBoardItem = >>> dynamic_cast<BOARD_ITEM*>( newTrack ); >>> newBoardItem->SetPosition( >>> nearestEndLocation[itemCount] ); >>> dynamic_cast<PCB_TRACK*>( newBoardItem >>> )->SetEnd( furtherestEndLocation[itemCount] ); >>> board->Add( newBoardItem, >>> ADD_MODE::BULK_INSERT, false ); >>> bulkAddedItems.push_back( newBoardItem >); >>> board->FinalizeBulkAdd( bulkAddedItems >); >>> .. and later >>> newBoardItem->SetModified(); >>> >>> Can anyone spot the issue with my code and why I would not get a >>> track showing up? >>> >>> Ta >>> Stuart >>> >>> On Saturday, July 15, 2023 at 1:29:04 PM UTC+1 Stuart Tyler >wrote: >>> >>> I have updated the code and I think the geometry >manipulation >>> is now close. >>> Please note the move multiple tracks key press that I have >>> coded up is Alt-M, not Ctrl-M. >>> Just need some help on adding tracks to a pcb so that the >>> solution can be fully visualised. There are probably a few >>> other corner cases that need handling yet, but its probably >>> useable once the track adds are fixed. >>> >>> Ta >>> Stuart >>> >>> >>> On Saturday, July 15, 2023 at 12:22:49 AM UTC+1 Stuart Tyler >>> wrote: >>> >>> Hi, >>> I have been busy extending pcbnew to include multiple >>> track dragging functionality. I have made some >reasonable >>> progress in getting to understanding the problem and >>> learning new stuff in c++ since I last used it, and lots >>> of KiCad internals, and fun geometry. >>> >>> Anyway my code is a mess, but my first objective was to >>> understand the geometry, which I have partly sorted out, >>> and there are many corner cases still to resolve. My >major >>> issue is that the >>> method EDIT_TOOL::doEndMoveTracksSelection() that does >all >>> the work needs to make/break some track and push these >>> back to the pcb. >>> >>> I have been through the code several times and a bit >>> confused on how to do this at all. I have looked at >other >>> pcb tools and get mixed up in various methods at the low >>> level LINE_PLACER, and then how to get this into the pcb >>> through BOARD. >>> >>> So in my fork of KiCad >>> (https://gitlab.com/stuarttyler/kicad >>> <https://gitlab.com/stuarttyler/kicad>), branch >>> MultiTrackEndMove, I have modified >edit_tool_move_fct.cpp >>> and lines 1244/1312/1332 the existing track is stolen to >>> see an output. This should not happen and new tracks >>> should be formed. >>> >>> EDIT_TOOL::doEndMoveTracksSelection() started out as a >>> copy of EDIT_TOOL::doMoveSelection() >>> >>> This was good as it showed me how to handle multiple >>> selections. But it does not do any track additions, so I >>> cannot seem to work that part out. >>> >>> Is this the best way to share my request? By posting a >>> link to my fork and point to my code? >>> >>> Currently I have added a new menu item and key press >>> ctrl-M. When there are multiple traces selected, the >ends >>> closest to the cursor all move in the direction >commanded. >>> There are a few bugs still to resolve, but I think Im >>> about 60% there with the major 3 situations identified. >>> There are a number of fold back situations that need >>> sorting out. >>> >>> First of all I need help on adding/breaking a trace >inside >>> EDIT_TOOL::doEndMoveTracksSelection() >>> >>> In summary: >>> sel_items is a vector of BOARD_ITEM* >>> std::vector<BOARD_ITEM*> sel_items; >>> >>> item get picked out using a cpp for loop to EDA_ITEM* >>> for( EDA_ITEM* item : sel_items ) >>> >>> I have worked out how to modify the PCB_TRACK start and >>> end locations >>> dynamic_cast<PCB_TRACK*>( item )->SetEnd( >myNewEndLocation ); >>> >>> But I cannot work out how to break this track into 2, or >>> add a new track to the board. >>> >>> What I think I want to do is to make a new BOARD_ITEM or >>> EDA_ITEM but I am obviously missing something on >PCB_TRACK >>> manipulation and EDIT_TOOL. >>> >>> Please help. >>> >>> Thanks Stuart >>> >>> PS - I know my code is very messy and horrible. I am >>> currently just getting to terms with all the new >geometry >>> and method/functions/internals. >>> >>> PSS - I plan on having something more >sensible/presentable >>> in a few weeks. >>> >>> -- >>> You received this message because you are subscribed to the >Google >>> Groups "KiCad Developers" group. >>> To unsubscribe from this group and stop receiving emails from >it, >>> send an email to [email protected] >>> <mailto:[email protected]>. >>> To view this discussion on the web visit >>> >https://groups.google.com/a/kicad.org/d/msgid/devlist/64d0d1d5-6a24-41c4-8231-a4a721f267c7n%40kicad.org ><https://groups.google.com/a/kicad.org/d/msgid/devlist/64d0d1d5-6a24-41c4-8231-a4a721f267c7n%40kicad.org?utm_medium=email&utm_source=footer>. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "KiCad Developers" group. >> To unsubscribe from this group and stop receiving emails from it, >send >> an email to [email protected] >> <mailto:[email protected]>. >> To view this discussion on the web visit >> >https://groups.google.com/a/kicad.org/d/msgid/devlist/4b954b95c8997.e6c27fd20fe7b%40gmail.com ><https://groups.google.com/a/kicad.org/d/msgid/devlist/4b954b95c8997.e6c27fd20fe7b%40gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "KiCad Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/kicad.org/d/msgid/devlist/00ffc215-e0ea-4312-b9e9-c327f96694e6%40gmail.com.
