Inkscape.org
Beginners' Questions How do I intersect this line stroke with this rectangle?
  1. #1
    redmoncorey redmoncorey @redmoncorey

    I have lines (made with the Bezier tool) and I want to keep only the part of the line which falls between the stroke of the rectangle. See below.

    I assume that it involves Path > Intersection as the last step. Before using Path > Intersection I have tried converting the line stroke and the rectangle stroke to path, but no luck with that.

  2. #2
    Polygon Polygon @Polygonโš–๐ŸŒถ

    Clip Group seems to be working for this use case.

  3. #3
    redmoncorey redmoncorey @redmoncorey

    I figured out a way to do it. Let me know if there is a better way:

    1. Convert the line stroke to a path.

    2. Convert the rectangle stroke to a path.

    3. Duplicate the inner rectangle path.

    4. Intersect the paths of the inner rectangle and the line path.

    5. Hide the "ends" of the line path behind the stroke path of the rectangle.

  4. #4
    Polygon Polygon @Polygonโš–๐ŸŒถ
    redmoncorey

    Let me know if there is a better way:

    Again: Clip group.

  5. #5
    David248 David248 @David248
    • You can use a clip group (it's an inkscape own thing), or group the lines and set a clip to the group.
    • You can use a pattern for the stripes, so that you can apply to any other shape, without fancy booleans operations or clips.

    ย 

    Concerning step 5, if you turn stripes stroke to path and then do an intersection with the inline of rectangle, you should not have issues with then ends of the stripes, imho.

  6. #6
    Tyler Durden Tyler Durden @TylerDurdenโš–

    If the goal is strictly visual, clipping and patterns can be useful.

    If the goal includes cutting with cnc, the geometry may need to be trimmed using path operations or the shape-builder tool.

  7. #7
    redmoncorey redmoncorey @redmoncorey

    Yes, Clip Groups is the best answer. I didnโ€™t even know that existed. Thanks!

  8. #8
    Polygon Polygon @Polygonโš–๐ŸŒถ
    David248

    You can use a clip group (it's an inkscape own thing), or group the lines and set a clip to the group.

    Not really - This was already possible when Freehand.app was launchedย in the 1980s via "Paste Inside", right up to today in current programs such as Affinity Designer where itยดs calledย  "Insert inside Selection".

  9. #9
    David248 David248 @David248
    *

    Sory, I didn't mean it was an inkscape original feature, I meant I wouldn't display correctly in browsers.

    See below in browser and open svg for examination in inkscape (open objects panel). For the clip group solution, I had to add a rectangle with no fill and the proper stroke, because clip group refers to path and not stroke width. Only this rectangle appears, not the clip group.

    ย 

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How do I intersect this line stroke with this rectangle?