Union two separate shapes with a line in the middle ?

Inkscape related questions, tips and topics can be posted here
Post Reply
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Union two separate shapes with a line in the middle ?

Post by TJS »

This is probably easy. I am not good at playing with nodes or drawing straight lines. So lets say I have two square boxes and and snap them together so there is just one middle line now. How do I do a union on these so it will create one rectangular object, i.e. remove that middle line.
Thanks.
ps- when using the bezier tool and I want to draw a straight line and I click the mouse at the end of the line it always goes crooked.
martyy
2.5 Star Elite Contributing Member
2.5 Star Elite Contributing Member
Posts: 170
Joined: Sun Jul 17, 2022 9:43 pm

Re: Union two separate shapes with a line in the middle ?

Post by martyy »

Did you ensure you did "object to path" after creating the rectangles? Double check using outline mode. This applies only if you created objects. If using only line tools, disregard. You should just be able to choose union and they will merge. Might have to overlap them a little but dont think so.
plasmanewbie
5 Star Elite Contributing Member
5 Star Elite Contributing Member
Posts: 2869
Joined: Thu Jul 24, 2008 11:15 am

Re: Union two separate shapes with a line in the middle ?

Post by plasmanewbie »

I am not a Inkscape guy, Corel is more my thing and in Corel the 2 boxes must be overlapping, even just the slightest amount will do. This is something martyy mentioned also so hopefully that works for you. Let us know.
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by TJS »

martyy wrote: Thu Mar 20, 2025 12:19 pm Did you ensure you did "object to path" after creating the rectangles? Double check using outline mode. This applies only if you created objects. If using only line tools, disregard. You should just be able to choose union and they will merge. Might have to overlap them a little but dont think so.
Yes they are object to path. And yes that is the only way i get them to union is to overlap them a little. To me that is cheating if you are targeting toward a specific size of an object.
User avatar
ROKCRLER
3.5 Star Elite Contributing Member
3.5 Star Elite Contributing Member
Posts: 681
Joined: Sun Sep 30, 2018 5:19 pm

Re: Union two separate shapes with a line in the middle ?

Post by ROKCRLER »

TJ, the two rectangles need to overlap a smidge then union (control ++)
you could make the two rectangles, place them where you want then drag either the top edge of the bottom rectangle or the bottom edge of the top rectangle to overlap the other and union.
4x8 Dynatorch
PM85
~Mo~
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Thu Mar 20, 2025 12:01 pm This is probably easy. I am not good at playing with nodes or drawing straight lines. So lets say I have two square boxes and and snap them together so there is just one middle line now. How do I do a union on these so it will create one rectangular object, i.e. remove that middle line.
Thanks.
ps- when using the bezier tool and I want to draw a straight line and I click the mouse at the end of the line it always goes crooked.

TJ - the rectangles don't need to overlap, they only need to be touching each other. Turn on your snaps and snap the corner of one rectangle to the corner of the other rectangle. Or you can snap midpoint to midpoint as well. See my attached screen shots.

David
rectangles 1.jpg
rectangles 2.jpg
rectangles 3.jpg
rectangles 4.jpg
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Thu Mar 20, 2025 12:01 pm
ps- when using the bezier tool and I want to draw a straight line and I click the mouse at the end of the line it always goes crooked.
When you are drawing your straight line with the Bezier draw tool, click on your start location, then hold down the Ctrl button on your keyboard to force the line to either horizontal or vertical - depending on which direction your are drawing your line.

David
ctrl.jpg
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

Or - if you turn on your grid display and enable Snapping to Grid, then you draw your lines they will automatically snap from one grid point to another grid point - thus keeping your lines orthogonal (vertical or horizontal).

David
ctrl 1.jpg
ctrl 2.jpg
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by TJS »

Thanks David. I tried the two rectangles just like you did and the Union does not work. I am going to try it again.
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Fri Mar 21, 2025 7:46 am Thanks David. I tried the two rectangles just like you did and the Union does not work. I am going to try it again.
union.jpg
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by TJS »

Are you doing Object to Path on both shapes before you Union them ?
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Fri Mar 21, 2025 9:18 am Are you doing Object to Path on both shapes before you Union them ?
It will work either way - rectangles or after your do object to path.
David
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJ - I have attached a file with the before and after sequence so you can see what it looks like. Also, be sure you have the appropriate boxes checked for your snaps settings.

David
tj1.jpg
TJ1.svg
(2.57 KiB) Downloaded 4 times
TJ1.svg
(2.57 KiB) Downloaded 4 times
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by TJS »

Thanks David. Unfortunately just my luck. My laptop has crashed. I am going to try and find my boot CD and see if I can at least get the files I need off of it or remove the hard drive. More fun. I will however try this on my table PC. It is an older version of inkscape but hopefully it works.
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Mon Mar 24, 2025 6:38 am Thanks David. Unfortunately just my luck. My laptop has crashed. I am going to try and find my boot CD and see if I can at least get the files I need off of it or remove the hard drive. More fun. I will however try this on my table PC. It is an older version of inkscape but hopefully it works.
TJ - I expect that it should work fine on any Inkscape version. I'm doing my cad work on a PC, don't have a laptop so I don't know if that could cause a problem or not with your Inkscape editing. Good luck with your laptop repair.

I still use Windows 2000, xp, and Windows 7 on some of my desktop computers - so don't feel too bad if you don't have the "latest and greatest" PC.

David
TJS
4 Star Member
4 Star Member
Posts: 817
Joined: Wed Nov 26, 2014 1:22 pm
Location: Fairfield, CT.
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by TJS »

adbuch wrote: Fri Mar 21, 2025 9:10 am
TJS wrote: Fri Mar 21, 2025 7:46 am Thanks David. I tried the two rectangles just like you did and the Union does not work. I am going to try it again.
union.jpg
So I got another laptop up and running. I did union the squares and they did become one rectangle that would in fact be cut-able path. However when drawing two circles or other shapes and have snapping on with no overlap and perform a union they are not one cut-able path as seen in your screen shot here I get the same results.
Thanks
T.J.
adbuch
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 11254
Joined: Thu Sep 21, 2017 5:22 pm
Location: Tucson, Arizona
Contact:

Re: Union two separate shapes with a line in the middle ?

Post by adbuch »

TJS wrote: Wed Apr 16, 2025 12:55 pm
adbuch wrote: Fri Mar 21, 2025 9:10 am
TJS wrote: Fri Mar 21, 2025 7:46 am Thanks David. I tried the two rectangles just like you did and the Union does not work. I am going to try it again.
union.jpg
So I got another laptop up and running. I did union the squares and they did become one rectangle that would in fact be cut-able path. However when drawing two circles or other shapes and have snapping on with no overlap and perform a union they are not one cut-able path as seen in your screen shot here I get the same results.
Thanks
T.J.


Yes TJ, that is correct. For the circles, ovals, etc. there needs to be some overlap. Just like adding "bridges" to hold part together.

David
Post Reply

Return to “Inkscape”