But I want to select all objects with a "Pattern fill". The "Select same" context menu does not offer to select this kind of objects. the objects I want to select contains differents fill.
Yes, to clear it up, I've done three files in the "Test-steps.zip" attachment, which are the steps I want to do. The first svg file is the starting point, and the paths are filled with a Pattern. The second file is the result of the "Pattern to Objects" commands, the first thing I want to script. For each path which is filled with a pattern, flatten it with "Pattern to Objects". The third file is the final render i need, all patterns are set as Clip, but I think that's will be in a second step.
I think with an xml parser it's possible, like in the Inkscape scripting. But my main question is also how to convert the Path data in a Clipath/Path data as it seems to do a flatten calculation in Inkscape, and I don't know how to do it in python.
It might be possible to make a script or extension, but it will not be simple. I don't think there are any current extensions that perform the required sequence of operations.
I'm not sure what is meant by a "flatten calculation", it's not a common term in Inkscape. The path data is there, it can be seen in the xml editor... after Pattern>Object the path coordinates remain unchanged from the original.
Sadly, it produces error messages on Windows ( still works ) .
It seems that the management of temp files in Windows is a bit more complex than I imagined. 1 error msg for each object converted and a final error msg lol
My main problem is now that the new clipped path is pasted at the end in the XML Editor. So in topmost position, not it is original position, so, I lost the order of my graphics.
Now, i'm searching a way to move it to the original position. But I don't find a lot of solutions to move path node (Raise or Lower). I see a "rendering_order()" method, but I do not understand how to get the orignal xml node position and then Raise the new one to it.
Hello,
I'm searching how to select all the objects in my document which have a "Pattern fill"? For later doing a "Pattern to objects".
Thanks in advance,
Maelvon
Select one then context-click->Select same: etc
But I want to select all objects with a "Pattern fill". The "Select same" context menu does not offer to select this kind of objects. the objects I want to select contains differents fill.
You didn´t mentioned it. Will an invert selection then probably work?
Maybe this:
Other objects may also be selected, but worth trying.
Thanks @TylerDurden. I found a way with the "find/replace" menu. Using "fill".
Then my question is:
I convert the Pattern fill to objects with Objects / Pattern fill/ Pattern to Objects menu. Which give me a shape and an image.
That's ok. Then I want to set the path as Clip for the image.
But, I want to repeat this for several objects (all the pattern filled ones).
Is there a way to script it or repeat this kind of actions?
My purpose was to convert Pattern filled shape to Clipped image by shape in fact. Perhaps there is already an Inkscape menu that I've not saw?
Thanks in advance.
Maelvon
I don't know if there is an existing script or extension. But I may not be entirely clear on the process and outcome you are seeking.
If you can make a screen video or step-by-step screenshots with annotations, that may help.
Yes, to clear it up, I've done three files in the "Test-steps.zip" attachment, which are the steps I want to do.
The first svg file is the starting point, and the paths are filled with a Pattern. The second file is the result of the "Pattern to Objects" commands, the first thing I want to script. For each path which is filled with a pattern, flatten it with "Pattern to Objects".
The third file is the final render i need, all patterns are set as Clip, but I think that's will be in a second step.
I think with an xml parser it's possible, like in the Inkscape scripting. But my main question is also how to convert the Path data in a Clipath/Path data as it seems to do a flatten calculation in Inkscape, and I don't know how to do it in python.
It might be possible to make a script or extension, but it will not be simple. I don't think there are any current extensions that perform the required sequence of operations.
I'm not sure what is meant by a "flatten calculation", it's not a common term in Inkscape. The path data is there, it can be seen in the xml editor... after Pattern>Object the path coordinates remain unchanged from the original.
This piece of code will do it.
Works fine in Ubuntu
Sadly, it produces error messages on Windows ( still works ) .
It seems that the management of temp files in Windows is a bit more complex than I imagined. 1 error msg for each object converted and a final error msg lol
https://gitlab.com/inklinea1/fill-pattern-clip
Thanks @inklinea, that's a great extension.
My main problem is now that the new clipped path is pasted at the end in the XML Editor. So in topmost position, not it is original position, so, I lost the order of my graphics.
Now, i'm searching a way to move it to the original position. But I don't find a lot of solutions to move path node (Raise or Lower). I see a "rendering_order()" method, but I do not understand how to get the orignal xml node position and then Raise the new one to it.
I tried a slight improvement, which seems to keep the z-order.
However I just can't seem to get it to work without the errors on Windows
https://gitlab.com/inklinea1/fill-pattern-clip
Whaa! That's great @inklinea, ok, you keep the old id, then your replace it.
I've try to get the previous element id to then place the new one after it, but without success for now. Your solution is better!
It seems to run on Windows here, I see you untabbed the last try,/except, which seem buggy on previous version.
Can it be faster if you use StringIO? instead of a Temporary file on disk.
That was an indentation error, which meant that the temp file was not being deleted :)
I'm not sure if you can do a command call using a StringIO