Connector tool tutorial

From Inkscape Wiki
(Redirected from UsingTheConnectorTool)
Jump to navigation Jump to search

This page is outdated. It is kept for historical reasons, e.g. to document specific decisions in Inkscape development.


Other languages: العربية Català Česky Deutsch English Español Français Italiano 日本語 한국어 Polski Português Português do Brasil Русский Slovenčina 中文

Using the Connector tool

The connector tool currently supports autorouting polyline connectors. These connectors can be attached to the shapes, i.e. pretty much anything that is not an open path. When the shape is moved the connector will update itself to follow the shape. In addition, connectors will avoid objects marked as 'avoided' and reroute if one of these objects is placed on their existing path, or is moved and frees up a new path.

Mark shapes as 'avoided' or 'ignored' for connector routing.

While in the connector context there are two toolbar buttons on the tool toolbar. The first of these marks all the objects in the current selection as avoided for connector routing. Correctors will avoid these shapes. The second button marks all objects in the current selection as ignored for connector routing.

Currently, just the shapes bounding box is used for the avoidance. The preferred approach is to use each shapes convez hull. Currently Inkscape's NR::ConvexHull only uses a rectangular bounding box. Once proper convex hull code is in the codebase connector routing will be switched to using that.

Drawing new connectors

Click and drag from any empty point on the canvas to create a new connector. If you begin or end the connector over a connection point, then the connector will be attached to that shape. Connection points are currently shown at the center (of the bounding box) of any shape, and are shown when the mouse cursor is over the object.

Rerouting an existing connector

If you click on a connector in the connector context, a handle will be shown for each of its endpoints. Dragging either of these will alter the endpoint of the connector. If the endpoint was attached to a shape then this connection will be removed. Again, if the this dragging ends over a connection point, then that end of the connector will be attached to the object. Connectors will automatically reroute during this operation.

Automatic rerouting

If an 'avoided' shape is placed over an existing connector route, then the connector will automatically reroute to avoid the shape. Also, if moving or deleting a shape frees up a better (currrently meaning shorter) path then the connector will again be rerouted.

What's next

There is lots more interesting things to do. One of the important ones (I think) is to allow conectors to be attached to user placeable connection points. This is something I would like to get people's thoughts on, i.e., what would you use them for, what would you want from them, etc.

Also, please have a play with connectors and let me know what you like/dislike. What works for you, what doesn't. I'm very interested in hearing peoples opinions and in working further on making this part of Inkscape realy useful to users.


-- Michael Wybrow

Comments

I think having user placeable connection points would be really helpful; it could allow you to do things like flow charts in Inkscape. That would open up Inkscape to usage as a helpful charting tool as well. - cam

Besides user placeable connection points it would be cool if it would be possible to use an outset of the convex hull. It would allow arrows or lines to clearly point to an object while not touching it. Often this is visually more pleasing. Another point would be to "fix" markers such that it is possible to use the tip of the arrow as the endpoint of a polyline instead of the point the marker is placed on. - Paul

I second Paul's suggestions. In 0.43, the effect can be created with an invisible dynamic offset, but its a bit of a cludge. - Jon

Yes, user-placeable connection points are the one single missing feature that just stopped me from using Inkscape for some control system block diagrams. I could easily do them in dia, but I was looking for a tool which can easily generate nice-looking "presentable" graphics. I will now probably draw them in Xfig. One more comment regarding connectors: it would be nice if the arrowheads and other shapes that can be used for either the connection end points or in the middle would automatically inherit colour etc. from the connection line. Currently they always come up as black, and it takes some SVG/XML tweaking to get them right. Just my 2 cts worth. - Helmut Walle.

Agreed; proper connectors are pretty much essential for many kinds of system diagrams. It would be nice to have connectors attach to path nodes, or an option to create connector points at or between nodes. -- Andrew.

Here here! User placeable connection points are the only missing feature holding me back from using Inkscape 100%. To draw complicated network diagrams I am forced to use Visio since there's nothing (that I'm aware of) in the opensource world, short of more complicated CAD packages, that can do technical drawings with user connection points, stencils, scaling, etc ... but Inkscape comes the closest. It's almost there! -Adam

I agree with all above and must say that I love this tool very much. I have an idea about how to go about the connector points, what if each object in an object group kept its individual connector point (they don't at the moment). In that way it would be possible to create complicated objects with a flexible amount of connector points. This leads to another feature that I would like to have and that is some sort of object gallery where I can store objectgroups I create. Much like the Visio software has with precreated objects. Both of these features combined would bring extra strength to the already poverful Inkscape software. - Mikael

The connector tool is a great idea, but it's not usable for me since it only draws edges connecting the bounding boxes, which looks really bad for circles. I imagine it would be easy to draw the edges between the centers of the objects (or the connection point, when that's possible), and keep the edge behind the objects being connected. This way, the edge would properly "touch" both connected objects. --Gfonsecabr 21:19, 25 April 2007 (UTC)

Just another "me too" on the connector tool needing to draw correctly to shape edges rather than bounding boxes and have definable connection points. This would promote inkscape from "borderline unusable" to "darn near perfect" for drawing the sorts of diagrams I need. The bounding box issue is far more important in my use case, which is network diagrams and the like to be presented to management and clients. I've used dia in the past for this, but the visual quality of the diagrams it creates just aren't quite up to par. --Qhartman May 9, 2007

I also vote for the connector tool needing to draw correctly to shape edges rather than just the bounding box. In my case, I add connectors between circles and then import the graphics into LaTex. It is the only reason I can't use Inkscape for "serious" work. Not completely sure of this, but could I accomplish nearly the same thing by defining user defined connectors every 45 degrees around the circle? I've started experimenting with the textext tool, but haven't gotten it work just yet. Not sure how much I'll pursue textext until the connector problem is fixed. -- --Tesseract 17:49, 6 June 2008 (UTC)

I would like to see curved connector lines. I make a lot of FSM diagrams and need two connector lines going between two separate shapes (in either direction). It would be great if I could just specify one value (the curvature) and have two lines connect two shapes curved with the given curvature. --Robert.l.toscano 06:42, 13 February 2008 (UTC)

I played around with some variations of connectors' behaviour: Making them avoid the convex hull of objects (Patch 01), making them connect to the outer hull of an object (Patch 02) and making them connect to nodes along an object (Patch 03, working demo SVG). All patches are against Inkscape SVN r19799. Personally, I like the last variant best. It's easy to use and straightforward to implement. --Sommer 19:49, 8 September 2008 (UTC)

I often need forward and backward connections between boxes in flow diagrams, where both arrows should be visible and where text is attached to the arrows. The current routing does clumps all in only one determined line. This prevents me from using the Inkscape for diagramming so far. I need more control on the rounting. In Smartdraw,Powerpoint, Dia etc, I can say if it is a bow or a rectangular line with several corners/nodes. For example I can draw connectors that go upward from a shape, then sideward to another shape and downward again for one dirction of the arrow. The backward arrow then goes first downward, side and upward again. --Tomaschwutz 16:22, 15 December 2008 (UTC)

Just another confirmation for needing placeable connection points in order to do the entire task in one application. I'm sure I'll eventual find serious uses for them. At the moment, however, I want to place them on warp points, doors, and other portals of conveyence, within videogame maps I have assembled.


Problem: We have two objects (let's say boxes) which overlap each other in a way that the upper box covers the lower boxes' connector handle. I couldn't make out a way to drag/click on the connector handle of the lower box, because each time my mouse pointer reaches the position where the lower connector handle is displayed, it disapears and the upper connector handle is displayed.

Is there realy no way to do this, or could I just not figure it out?

Suggestion for Solution: I could imagine the following solution to this problem: You move your mouse pointer around until the desired connector handle appears. Then you press and hold a meta-key like alt / ctrl / shift. Pressing the appropriate key disables the automatic appear/disappear mechanism and you can move freely to your desired connector handle. (Without fearing, that it could disappear just in front of your nose.) ;)

Workaround: Until a solution is found, the following cumbersome workaround may help: Move the lower object away from the upper object, so they won't overlap anymore. Than connect your connector and move the lower object back in the old position.

--Px79 14:11, 26 May 2009 (UTC)


Still to do: (lifted from src/connector-context.cpp)

   o  Have shapes avoid coonvex hulls of objects, rather than their
      bounding box.  Possibly implement the unfinished [[ConvexHull]]
      class in libnr.
   o  Draw connectors to shape edges rather than bounding box.
   o  Fix minor endpoint position error for connected objects.
   o  Show a visual indicator for objects with the 'avoid' property set.
   o  Create an interface for setting markers (arrow heads).
   o  Better distinguish between paths and connectors to prevent problems
      in the node tool and paths accidently being turned into connectors
      in the connector tool.  Perhaps have a way to convert between.
   o  Allow doubleclicking on connectors to swap to the connector context.
   o  Cleanup to remove unecessary borrowed [[DrawContext]] code.
   o  Allow user-placeable connection points.
   o  Deal sanely with connectors with both endpoints attached to the 
      same connection point, and drawing of connectors attaching
      overlaping shapes (currently tries to adjust connector to be
      outside both bounding boxes).
   o  Fix many special cases related to connectors updating,
      e.g., copying a couple of shapes and a connector that are
            attached to each other.
      e.g., detach connector when it is moved or transformed in
            one of the other contexts.