Single command (Like Ctrl-L) to automatically distribute pads, pins, and bcps to align horizontally with the I/O on the node that’s also in the selection, and then space vertically so labels are clear of each other.
So we go from this:
Quick cleanup, particularly after changing the order of pins on a node.
//Setting X values
ForEach node in the selection:
ForEach node Input/Output that is connected to something
IF link connects to a pin, pad, iobox or bcp thats also in the selection align it to have the same X position as the IO pin on the node.
- Special case: IF multiple are connected to outputs (see ''Hey" pad and “HeyOut” pin) then should have an X offset on the further elements. (it won’t work well with >2 elements in the selection connected simultaenous but I think this is a rare case).
- Special case: Output BCPs are checked if they have an input pair in the same selection that is not connected to the node but is connected to an pin, pad or iobox in the selection. In this case they (and the connected element) are given the same X as the BCP plus an offset. (see “DefaultNumber” iobox on BCP “II”). It means the BCP label probably collides, but this is better than overlapping with the link so it’s not accidentally confused that the input goes through the BCP.
//Setting Y values
ForEach pin, pad and iobox that was moved group by input and output. Go through left to right and check if it overlaps with any previous labels… if so move Y position down so its clear of other labels.
Take the final rectangle bounds of input and output element groups and shift the Y position of all objects so they are clear of the node and any region.
//What about the case of labelled BCPs that will overlap?
It’s not ideal… labels already overlap now using the node minimum spacing. Maybe the font could be smaller?
In the case the user has manually specified BCP labels the user should also stretch the node horizontally wider before using this command so that there will be appropriate horizontal space to accommodate BCP labels. Although could be a separate command that does the same thing but spaces out BCPs based on their label length and horizontally orients pins, pads and ioboxes to those positions.