1

Is there a way to replace objects of the canvas by another respecting the proportions?

For example, in my drawing I have many rectangles of different sizes and I want to replace them with another shape or symbol but respecting the dimensions of the original rectangles.

With clones, perhaps?

enter image description here

UPDATE: It is important to note that there are many objects that I have to replace. Replacing manually is not an option. I have maps that are being imported into Inkscape with symbology in different sizes and the goal is to replace them with others automatically or semi-automatically.

3

There are two functions that can be used in Inkscape to make this work:

  1. Edit > Paste Size
  2. Objects > Align and Distribute > Swap positions

You can assign keyboard shortcuts to those in the preferences to speed using those up.

If you want to automate this, you can write a command line script or an Inkscape extension (that uses a command line script, as of Inkscape 0.92.4).

  • 1
    I think this is the way. I'm going to see how I can do this transformation and reorder the shapes or symbols in a massive way. Thank you. – Jesus Gomez Feb 25 at 9:17
2

A manual workaround:

enter image description here

Make a group which contains a rectangle (=green) and the shape.

Place copies of the group on the rectangles and stretch them to fit. It snaps easily if you have the bounding box snap on. Beware double clicking. It selects a part of the group and breaks the placement easily.

Finally ungroup all and delete the extras. Edit menu has "Select same fill color" which speeds up the selection and deletion.

It can be a good idea to save the original rectangles, only lock and hide them in the layers panel.

  • Thank @user287001 for your answer. It's a good way for a few objects but I can't replace the objects manually because they are so many. – Jesus Gomez Feb 25 at 8:37
0

Here's an outside-the-box solution: use a symbol font instead of objects.

On the menu, click Edit and then Find/Replace, and replace the old icon with the new one. There are plenty of icon fonts that have basic shapes like triangles and squares. Since its text, the formatting (fill, size, etc) should be preserved during the replace.

Inkscape isn't fantastic with actually entering glyphs though, so you might need to copy/paste icons from a different application, or open the SVG in a text editor to do the find/replace. Some icon fonts might give you more trouble than others.

0

Yes, it is possible to do it with clones, but you would need to group and clone the red square. Then create the layout of the squares by using clones. So, obviously some forward planning would be required.

Then you could edit the clone source group by double clicking it to enter the group, then paste in your graphic inside it, and finally delete the red box.

For example:

enter image description here

Note: To exit the clone source, double click outside it. To scale the initial red box clones proportionally, hold down CTRL as you click and drag a corner handle.

  • Thank Bill but I can not create the design of the squares using clones because those shapes are imported into Inkscape from a mapping software. – Jesus Gomez Feb 25 at 8:45
  • That's why I included a caveat in my answer: "but you would need to group and clone the red square. Then create the layout of the squares by using clones". If you can't do that, then go with Moini's solution instead. – Billy Kerr Feb 25 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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