Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board Editor: Simplify Trace command #737

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

5n8ke
Copy link
Member

@5n8ke 5n8ke commented Jul 23, 2020

A command that simplifies all the NetSegments of a NetSignal by removing duplicate items and combining disconnected parts of a NetSegment.

Features

Summary

  • Combine NetPoints at the same location
  • Replace NetPoints with Vias at the same location
  • Combine NetLines forming a straight line
  • Combine NetPoints and Vias with underlying NetLines
  • Remove duplicate NetLines connecting the same two anchors

Principle

  1. Select a NetSignal to be simplified.
  2. (TODO) Connect disjunct NetSegments
  3. Simplify every NetSegment of the NetSignal
    1. Remove duplicate NetLines
    2. Combine duplicate NetPoints at the same location and layer
    3. Connect NetPoints with NetLines crossing their location
    4. (TODO) Connect NetLines crossing each other
    5. For every Via
      1. Replace NetPoints at the Via location with the Via
      2. Connect the Via with NetLines crossing its location
    6. Remove Duplicate NetLines
    7. Combine NetLines forming a straight line (Fixes Board Editor : Remove unnecessary nodes of wires when extending them #710)

During the operation, duplicate NetLines and NetPoints are combined multiple times, since some of the more complex simplifications can create these duplicate items.

TODO

  • Replace NetPoints with Pads at the same location
  • Connect disjunct NetSegments
  • Connect crossing traces
  • Connect planes

@ubruhin
Copy link
Member

ubruhin commented Sep 1, 2020

Are you actually waiting for my comments on this PR, or is it work in progress on your side? So far I didn't really review it because it's still a draft 🙈

This will for sure conflict with #760, but hopefully it shouldn't be too hard to resolve since it mainly "only" adds an additional tool (not modifying existing tools) 🙂

@5n8ke
Copy link
Member Author

5n8ke commented Sep 1, 2020

It currently a work in progress on my side. If you've got time, I'd be happy about some initial comments but right now I've got enough stuff to work on.

- New Tool class created and added to GUI
  - Remove duplicate NetLines with the same start and end points
  - Merge NetPoints at the same location
  - Connect Vias with the NetPoints and NetLines at the same location
  - Connect NetPoints with NetLines at the same location
  - Plan out other simplifications
  - Simplify NetLines forming a straight line
- new CmdBoardCombineAnchors undo command group, that combines anchors of the same NetSegment. Based on combineAnchors in BoardEditorState_DrawTrace
- Add default nullptr when searching for items at location
- Add myself to AUTHORS.md
@5n8ke 5n8ke added this to the 0.2.0 milestone Sep 4, 2020
@5n8ke 5n8ke changed the title "simplify" command Board Editor: Simplify Trace command Sep 4, 2020
@ubruhin
Copy link
Member

ubruhin commented Sep 13, 2020

I quickly tested this feature. The simplification seems to work fine so far! 👍 However, I have some thoughts:

  • Actually I don't understand why we need a separate tool for this feature. Wouldn't it make more sense to integrate it in the already existing tools?
    • In the "Draw Trace" tool, just automatically simplify the modified net segment after finishing a trace. Maybe this feature could be made configurable whether it is active or not, but so far I don't see a case where we don't want to simplify traces.
    • In the "Select" tool, a context menu entry for traces could be added to simplify the net segment of the selected trace.
  • Why simplifying all net segments of a given net signal? Since net segments are independent from each other, I'd only simplify single net segments...
  • Regarding implementation, it might make sense to create a new undo command class like CmdSimplifyBoardNetSegment (maybe replacing CmdBoardCombineAnchors?) to easily share the feature between different tools.

@dbrgn
Copy link
Member

dbrgn commented Sep 13, 2020

but so far I don't see a case where we don't want to simplify traces

When drawing a straight trace, you might want to place an anchor point at a specific location, so that you can snap to that location from another trace.

@ubruhin
Copy link
Member

ubruhin commented Sep 14, 2020

When drawing a straight trace, you might want to place an anchor point at a specific location, so that you can snap to that location from another trace.

Hmm but you can also connect a trace to another trace without any anchor point 🤔

@5n8ke
Copy link
Member Author

5n8ke commented Sep 15, 2020

Thank you very much for the feedback!

  • I have no strong opinions about simplification being its own tool or part of the Select/draw tool.
  • I second the implementation as a Commandgroup. It will be done with my next round of improvements.
  • I simplified all NetSegments of a signal, since as a second (or preferably first) stage, I envisioned the connection of technically disjunct, but visually connected NetSegments.

@dbrgn
Copy link
Member

dbrgn commented Sep 15, 2020

Hmm but you can also connect a trace to another trace without any anchor point

Yes, but then it snaps to the grid, not to the existing anchor point. If you draw the second trace with a different grid setting than the first one, having an anchor point for snapping might be desirable.

Nevertheless, I'm not sure how important that really is... It can be worked around by changing the grid again.

@ubruhin ubruhin modified the milestones: 0.2.0, 0.2.1 Jan 15, 2023
@ubruhin ubruhin modified the milestones: 1.1.0, 2.0.0 Mar 12, 2024
@ubruhin ubruhin modified the milestones: 2.0.0, 1.2.0 Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Board Editor : Remove unnecessary nodes of wires when extending them
3 participants