Apply selection shape to different object?

Post questions on how to use or achieve an effect in Inkscape.
stlolth
Posts: 3
Joined: Tue Sep 18, 2012 2:56 pm

Apply selection shape to different object?

Postby stlolth » Tue Sep 18, 2012 3:01 pm

I would like to apply the selection shape/outline of object A to Object B, so i can cut out a shape from object B of the same size and shape as object A. Is this doable?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Apply selection shape to different object?

Postby brynn » Tue Sep 18, 2012 4:33 pm

Welcome to InkscapeForum!

Yes, absolutely it can be done :D But I have a question first. Is the result that you want the donut, or the donut hole? Or if the screen is a piece of paper, do want the paper with the hole for the result? Or do you want the circle that was cut out? Or both?

stlolth
Posts: 3
Joined: Tue Sep 18, 2012 2:56 pm

Re: Apply selection shape to different object?

Postby stlolth » Tue Sep 18, 2012 6:48 pm

The donut hole. In other words, i'd like the shape of object A to become a hole in object B. Thanks for the response!

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Apply selection shape to different object?

Postby brynn » Tue Sep 18, 2012 11:27 pm

Actually I'm not sure if you understood my question. I mean the kind of donut hole that you can eat -- the part that comes out of the donut when they punch the hole out of it. I think in this case, you can probably learn something by doing both. And they're not so hard to write out.

What kind of objects are they? Object A will have to be a vector object, for any of these things to work. Object B could be an imported raster (photo, PNG, JPG, etc.) or a vector object.

For donut hole -- if B is a raster image, you'll need to use Clipping:

1 -- File menu > Import, to import B
2 -- Place A over B
3 -- Using Selection tool, click on B, hold Shift key while you click on A. This selects both objects.
4 -- Object menu > Clip > Set

If B is a vector image, you have more choices for what to do. Clipping will work here too. But Path Intersection might be better:

1 -- Using Selection tool, select both objects, as above
2 -- Path menu > Intersection.

So you can see, that with both of these techniques, you're left with the hole of the donut, and the donut is gone. There's no longer an Object B. But you've said that you want Object B with a hole in it. That's the donut, in my analogy. But no worries, you can do that too.

For donut -- if Object B is a raster image, this will be a little trickier, because Object A will have to be modified. Object A still has to be a vector object.

1 -- Import the raster image.
2 -- Select A, and if it's not already converted to a path, do Path menu > Object to Path. If you're going to need A again later, be sure to duplicate it now.
3 -- Place A over B.
4 -- Draw a brand new object that's larger than Object B. A simple rectangle around it will work.
5 -- Select it and do Path menu > Object to Path.
6 -- Select both Object A and its new piece, then do Path menu > Combine.
7 -- Click on any color, it doesn't matter what color because this object is going to disappear.
8 -- If the new color fills both paths, and you don't have a rectangle with a hole in it, you'll need to Undo 2 steps back to right before you combined them.
9 -- Select one of the paths and do Path menu > Reverse
10 -- Now select both and do Path menu > Combine again. Now you should have a rectangle with a hole in it.
11 -- Select that newly modified Object A, and Object B (the raster image), and do Object menu > Clip > Set.

Now you have Object B with a hole in it that's shaped just like Object A. And if you duplicated A before modifying it, you have both the hole and the donut.

If Object B is a vector image, this will be much simpler:

1 -- Place A over B
2 -- If you need to use A later, be sure and duplicate it now
3 -- Select A and B
4 -- Path menu > Difference

Hopefully, somewhere in this message, I've covered what you want to do. Let us know if you get stuck, or if this isn't working for some reason :D

stlolth
Posts: 3
Joined: Tue Sep 18, 2012 2:56 pm

Re: Apply selection shape to different object?

Postby stlolth » Wed Sep 19, 2012 3:29 pm

Thanks for the in-depth response, i'm sure all of it will come in handy eventually. Both objects were vectors, so i selected A and B, used Difference and that did the trick; i had a hole the shape of object A in object B, and object A was gone. Perfect. I was a bit confused though, because using Difference turned object B black, i'm assuming that's normal. I just colored it back to it's original color and everything was tip top.


Return to “Help with using Inkscape”