Closed jxyun99 closed 2 years ago
Can you tell me in detail what script should do? Do you mean top object in group or in the layers or something else?
Now the script uses ClipBoard to replace the object, I want to replace it with the top element in the document
alexander-ladygin’s script can do this, but his script If the replaced element contains a stroke, the replacement will cause it to be out of center
I made a version of the script that works with the top object. It seems to work correctly with objects with a stroke.
Do you want me to add a checkbox to select the original object or does a separate script fit you?
use Top-object Replace can work, but even if ignore stroke is selected, the object is still not centered after replacement
OK, I figured it out — it happens when your target object is a group. If you ungroup it, everything should work all right.
When you group an object, the script cannot detect the stroke and ignores it when calculating a new position. It is possible to make a workaround, but there may be side effects.
no, i don't group it
No, I mean one object is group itself. Like this:
It’s very strange, my rectangle is just a stroke, it is no group itself
Can you send me your illustrator file? I'll try to find out why the script doesn't work properly.
I have put the file at https://github.com/jxyun99/test ,I don’t see anything special, it’s just that my AI version is Chinese
I think, this is a rounding error. Please try this version and tell me if it works.
Now, even if the element is stroke, it can work, but I found other bugs. If the Replacement object is a compound path, it doesn’t work, and if the Replacement object is a group, it doesn’t work。
As always, I fixed something and broke something :) I rewrote half of the script, now it must work with most types of objects.
Thank you. It can work now!
Thank! Is there any way to use this script to replace the object by the name of the linked image? For example, I want use the selected objects to replace the linked images of selected,the the linked images named is “dog.jpg ”
I don't quite understand what you want to do, but you need a separate script to replace linked objects. You can try this script, it replaces all selected linked files with a new one.
Today, when I tried to replace it with a mask object,I found If the object is a group and contains a mask, it will not work properly(Position error),I tried to modify it myself, but it didn't work。 I collected a function to get the size of the mask object. I wonder if you can try to fix it,thank you! I have put the file at https://github.com/jxyun99/test Including test files and GIF demo
Sorry for delay! I fixed this issue and added the option to scale strokes. I used your function to get the size of the mask. It was very helpful, thank you! New version of script is here
Can you add a feature to let Replace-Objects.jsx support use top-level object replacement? Thank you! From Google Translate