Applying Style Changes to SVG that updates other SVG Files?

Post questions on how to use or achieve an effect in Inkscape.
tinal
Posts: 3
Joined: Wed Feb 26, 2014 5:10 am

Applying Style Changes to SVG that updates other SVG Files?

Postby tinal » Wed Feb 26, 2014 8:40 am

Hello!

I'm fairly new to Inkscape and SVG and would like any sort of help or push in the right direction.

I have several SVG shapes that are saved individually which I then imported to a new document to create a diagram. Is there a way that if I make a change to one original shape (i.e. square.svg, like changing it to a solid blue color) that when its saved, it also updates the color in the diagram document that I created?

I think this also ties with linking, but I haven't been able to successfully link an SVG file to another SVG. I can import it, but it doesn't create any relationship to the original svg shape file.

Any ideas?

Thanks in advance!

Uktrunie
Posts: 154
Joined: Sun Jul 18, 2010 4:48 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby Uktrunie » Wed Feb 26, 2014 12:06 pm

Well, I'll be damned. Apparently there is. Not automatic, mind you, but after the initial "setup" you should be good to go.

Here are some links (I couldn't make them work in Inkscape though):

http://stackoverflow.com/questions/5451135/embed-svg-in-svg
This one was shown correctly in my browser (Opera): http://alchemise.net/Svg/Main.svg (look at the xml source of that svg so you can see how it works)


EDIT: I just realize you're new to Inkscape... So this might not help you at all. :P But, well, good luck and welcome!

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby Maestral » Wed Feb 26, 2014 10:11 pm

^ This is a very neat solution.

Still, if you find it dificult to apply - try with the Cloned duplicates. You`ll need to import desired/needed elements and Clone them. Later on, changes on the original element would apply on clones. Even later on, you could export these original elements as separate files (there are some scripts for batch expport on forum).
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

tinal
Posts: 3
Joined: Wed Feb 26, 2014 5:10 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby tinal » Thu Feb 27, 2014 3:09 am

Thanks guys! I'll try both these methods and report back if I run into any issues :)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby Lazur » Thu Feb 27, 2014 7:29 am

Tried the recursion described on that site but it only "freezed" the programs -thumbnail image couldn't be generated in nautilus, and inkscape refused to open up. Would have been interesting.

Uktrunie
Posts: 154
Joined: Sun Jul 18, 2010 4:48 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby Uktrunie » Thu Feb 27, 2014 9:37 am

Yeah, the only program where they worked for me was the Opera browser. I don't know if that's because the SVG specs have changed or simply because most SVG software doesn't implement that <image> tag.

tinal
Posts: 3
Joined: Wed Feb 26, 2014 5:10 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby tinal » Thu Feb 27, 2014 10:07 am

So here are my results.

1. Using the <image> tag to reference external files and it worked to some extent. I was able to change the original svg file and it updated in the diagram, the only issue was that when I opened the diagram in Inkscape, all it showed were "image not found". I was however able to view it in several different browsers and it was fine, it was just not very useful for using Inkscape.

2. Cloning was an interesting approach however i was not able to get the two separate documents to connect, then again I'm not sure if i did this correctly.

Step 1: I saved my basic shape.
Step 2. Opened a new doc then imported that shape.
Step 3. I cloned the basic shape (SHIFT + D) in the new document, clicked save.

Then this is where I got lost as I tried to save this as a separate file, but there was no relationship between the original doc and this.
So, how do you get the cloned shape into a separate file? I know Maestral mentioned a script for Batch Export, but I couldn't find a link on here to how to do that.

And thanks everyone for all your replies, its really helping me through this troubleshooting.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: Applying Style Changes to SVG that updates other SVG Fil

Postby Maestral » Thu Feb 27, 2014 6:30 pm

This is the script which I had in mind. To be franc, I haven`t tried it yet. On the other hand, is there any real need for separating basic shapes in the individual files?

Could you try to solve this with layers? This way, you`ll have basic shapes in one layer, placed somewhere outside of your "diagrams" which will be on separate layers? Another thing could be a "template file" just with the bacis shapes, which you`ll then edit and save as "diagram xy"?
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:


Return to “Help with using Inkscape”