← Back to team overview

kicad-developers team mailing list archive

Re: How to SCH_SCREEN::SchematicCleanup?

 

Le 15/06/2016 à 02:33, Simon Richter a écrit :
> Hi,
> 
> for net ties, I have to touch the schematic cleanup, because that will
> merge adjacent wires going in the same direction, which is not useful
> for me, as I need all wires going into a tie as separate nets (except
> for ERC, where they are connected).

I do not understand why net ties are related to schematic cleanup.
They are 2 separate features.

Although no decision was taken, inside a schematic, the best way for a net tie is a virtual
component with 2 (or more) pins connected to each net and a specific footprint put on the board (to
control the location of nets connection, the connected layers ...

This is also the way used in other ECAD tools.

> 
> I'd like to generalize this to "wires are split at junctions and net
> ties." This has an immediate effect of making the Delete key behave the
> same as the Backspace key -- delete a wire segment up to the next junction.
> 
> This means that the implementation for the Backspace key can be greatly
> simplified, as we don't have to look out for junctions anymore -- we
> just delete the selected segment and are done.
> 
> The Delete key can be given a more useful function: delete across
> corners, but not across junctions. That is a change compared with the
> current implementation, where it would delete a straight wire across
> junctions, but not around a corner. IMO, having a way to delete an
> entire connection quickly is more useful, especially as a one-key undo
> after drawing multiple segments.
> 
> The other questions turning up there are related to the way
> SchematicCleanup works internally.
> 
> Right now, it consists of two loops over all schematic elements, with
> the inner loop starting after the current outer element, so for tuples
> (x,y), y > x in almost all cases. Almost, because when an element is
> deleted, the inner loop is restarted from the beginning of the list in
> case the current element was also the one that is now gone.
> 
> This is slightly fragile because there is no test that stops a line from
> being merged with itself and subsequently deleted as redundant, but that
> can happen only if the same line was merged already -- so you need three
> redundant lines to trigger that bug.
> 
> Other than that, it works well because the only cases handled there are
> wire-wire and junction-junction tuples. However, I need to introduce
> wire-junction tests, so the symmetry is gone. I can see a few ways how
> to proceed here:
> 
> 1. Always traverse the entire matrix and start skipping symmetric tests
> after passing the diagonal. This will double the number of iterations,
> but all symmetric tests are skipped in half of them, so the actual
> runtime increase is not that drastic.
> 
> 2. Create helper functions with fixed types, and use the appropriate
> parameter order. This is probably the least invasive.
> 
> 3. Order the draw list by element type. This would allow us to shave off
> a few more cycles in the O(N^2) cleanup function, but make insertion
> more expensive (although with caching, we can still keep it O(1)). This
> would also make schematic files a bit more easier to compare in version
> control.
> 
> 4. Order the draw list by element type and coordinates. This makes
> insertion quite a bit heavier, but saves quite a lot during the cleanup
> as we can terminate the inner loop if the hit boxes for the remaining
> elements can no longer overlap, and it would be really great for
> comparing files in version control as we'd have full normalization.
> 
> Questions? Comments?
> 
>    Simon
> 
> 
> 
> _______________________________________________
> 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
> 


-- 
Jean-Pierre CHARRAS


Follow ups

References