[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Snap-to-pins, was: Stupid newbie question



Ales wrote:
The way I see things, there are two ways of implementing the snap
to pin/net:

1. As the user draws nets, automatically snap to the nearest pin/net.
This would require a switch to turn this behavior off.
2. The mechanism that Dan pointed out above. Nice because
it keeps the existing net drawing behavior while providing
a nice way of getting the desired snap to nearest. Though,
it might require net routing algorithm if we want to deal
with strictly ortho nets.

1. is probably easier to implement at this stage though you might be able to make some assumptions/simplifications to make 2. just as easy.

Also, for now, I would only worry about snapping to the endpoints of
pins and nets. I don't think it is worth the effort (at this point)
to try to snap to the middle of nets or buses).
Since the SHIFT key is not checked as a modifier during net drawing, what I've done is integrated a check just below where the CONTROL key is looked for. That way the snap behavior is optional. I have an iterator doing what you described in your other e-mail message, basically just looking through every object and checking its endpoints if it's an OBJ_PIN. It also "drills into" OBJ_COMPLEX types looking for pins, although I wasn't sure if this was really important.

As I got into the structs and found where they were defined, everything started making a lot of sense. I used to do a lot of MUD development and having thousands of linked lists of structs all over the place is second nature to me. I've got a bug in it right now that's not finding the right endpoint coordinates but when I get it fixed I'll let everybody know, then you can show me the "right" way Ales.

Thanks, and regards,
Chad