10

Is there a trim command for lines/paths in Inkscape?

Example: given are two lines. After selecting both I'd like to press a button. Then both lines are elongated or shortened until they intersect. As a result I get a polygon consisting out of two lines.

It is similar to the wish found here: http://wiki.inkscape.org/wiki/index.php/Intersection_Tools

8
  • Are the lines straight?
    – Wrzlprmft
    Mar 9, 2015 at 10:15
  • It would be great if it is available for linear lines. (For bent curves the behavior would make sense only if derivative is known for each point...)
    – Gantter
    Mar 9, 2015 at 21:01
  • Derivative is known for all points of a bezier. Thats kindof the point
    – joojaa
    Mar 10, 2015 at 6:14
  • (correction: not derivative but function itself)
    – Gantter
    Mar 10, 2015 at 20:49
  • In order to highlight the power of this feature: you draw a short line vertically, you draw another line horizontally, then you press a button and both lines are connected with a right angle. This saves a lot of work if you draw electric circuits.
    – Gantter
    Mar 10, 2015 at 20:52

5 Answers 5

12

There is not a single tool or command to do this in Inkscape, but you can get accurate results by using the Path Editor, Snapping, Guides, and Object to Guides.

  1. Duplicate the your paths
  2. With the 3 duplicated paths still selected, convert them to guides with Objects > Objects to Guides
  3. With snapping enabled, move the nodes to the guide intersections.
  4. join the nodes at the points to make your single shape.

enter image description here

2
  • 1
    I didn't know this was possible. This will save me a lot™ of trouble in the future.
    – m00am
    Jul 26, 2016 at 11:51
  • Same here! Its extremely useful. Jun 3, 2017 at 1:04
3

No. This is not easily accomplished in Inkscape.

The closest work around would be to extend the two lines, and using snapping to draw a new path over them.

  1. Using the Node Tool F2, select the nodes to be extended.
  2. Hold Ctrl + Alt and drag the node to extend it. Repeat with the other line until they intersect.
  3. Turn on snapping. Make sure that "Snap to Intersections" is enabled.
  4. Draw a new line Shift + F6, using the end points and intersection of your two lines as snapping points. (If Inkscape doesn't automatically snap to these, check what snapping options you have set and try again).
  5. Delete the original two lines

If you're working with lines that are right angles, it might be easy to draw a single line between two end points, add a node in the middle, and then manually assign coordinates to that node instead of drawing a new line.

This operation isn't too difficult if you have 2 simple straight lines. There's a good chance that your drawing is more complex than this and you'll need to integrate this with other objects. The commands in the Path menu, such as Union can help with those finishing touches.

Inkscape can be extended with scripts. It might be possible to write a script that will do this all for you at the click of a button, as you wanted, however I'm not aware of any.

2

Enable snapping to paths and nodes, then move the first line to the intersection with the second line and then move the second line to the end of the first line.

1

I'd say the short answer is no, there's no such tool/button/command in Inkscape (that I'm aware of).

To solve the problem for trimming intersecting paths, apart from what's mentioned already you can also use Paths > Cut Path. Note that Cut Path deletes the upper path of the two and cuts only the lower path in parts. So to cut the two paths at their intersection, you'll have to do Cut Path twice, and duplicate each time the upper path first. After cutting the paths, you can delete the ends you don't want, and combine the remaining paths by using the Node tool, selecting the overlapping nodes on the intersection, and press the button "join selected nodes" (in the Tool options bar).

1

It's really simple. You can use the tool Path| Cut Path. Firstly select the line you'd like to "trim" and the limit line, than go to Path|Cut Path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.