Best Inclusion Methods

Post questions on how to use or achieve an effect in Inkscape.
User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Best Inclusion Methods

Postby kstingel » Tue Feb 16, 2016 10:26 am

Not sure if this has been covered anywhere ...

If I have a set of Patterns and Symbols which I re-use for multiple drawings in a project, what would be the best method to store them?

I'm thinking possibly saving my svg:defs into their own files (based on usage target) then importing to "images" into each SVG as they are needed
that way I would only need to define them once

Taking the above approach brings up my follow-up query ...

When saving SVGs for image import purposes, what data do I need to keep?

I assume namespaces and the like would not be needed as they should be taken from the parent image.
Since the SVG spec seems to have no notion of layers (as depicted in UIs), presumably the "Layer 1" group could be omitted
If there are no visible components (just defs), do I need to set a viewBox size?
... If I need the viewBox, do I need width & height, or could that be worked around with preserveAspectRatio?

I do have more questions, but I think that will do for the moment ;)

From what I have seen so far, there doesn't seem to be an "export for import" template

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Best Inclusion Methods

Postby Moini » Tue Feb 16, 2016 11:20 am

You can also just create a file with all your defs in it (take care to not clean the file using File -> Clean up document) and save it into your user templates directory. Then load it via File -> Templates.

See https://inkscape.org/en/learn/faq/#How_ ... _templates and https://inkscape.org/en/learn/faq/#How_ ... extensions to learn how to do this and where to save them.

I assume namespaces and the like would not be needed as they should be taken from the parent image.
Since the SVG spec seems to have no notion of layers (as depicted in UIs), presumably the "Layer 1" group could be omitted
If there are no visible components (just defs), do I need to set a viewBox size?


I'm not 100% certain, but these optimizations sound reasonable. You can take a look into the 'Save as ...' -> Optimized SVG dialog for more inspiration.

(do you want to import to Inkscape or into some other program?)
(I've seen somewhere that the viewbox width was just set to 100% and all worked well, also: not entirely sure if I remember this correctly, you'd need to try that out)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Best Inclusion Methods

Postby Moini » Tue Feb 16, 2016 11:23 am

And you can also add your patterns to the standard patterns file (but keep a backup, it could be overwritten on update), and create your own symbols library following one of the many available online tutorials, if you want to have the patterns and symbols available outside the template.
There are also readme files in the respective directories that describe what you'd need to do.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Best Inclusion Methods

Postby kstingel » Wed Feb 17, 2016 7:03 pm

@Moini:
I've opened the

Code: Select all

%InkscapeInstallPath%/share/patterns/patterns.svg

to use as a guide to creating my own pattern set - saved as

Code: Select all

%USER_HOME%/AppData/Roaming/inkscape/patterns/my_filename.svg

so I don't overwrite original

I notice that all the patterns have the line

Code: Select all

inkscape:collect="always"
at the start of the pattern ... do I need that line, and what does it mean?

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Best Inclusion Methods

Postby Moini » Thu Feb 18, 2016 2:30 am

Does that work?... I think currently you can only add patterns to the standard patterns file (at least that was the only thing that worked for me).

Also see http://www.silent9.com/blog/archives/14 ... scape.html
and
viewtopic.php?t=493

The Inkscape:collect thing is needed, I also don't know what it means.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: Best Inclusion Methods

Postby brynn » Thu Feb 18, 2016 12:37 pm

Well, this is all a bit over my head. But I just wanted to mention Object menu > Symbols. You can create your own custom symbols. And you can create a symbols file that's available in any of your Inkscape files. I don't know how to create a finished file like that, but I know it can be done. A lot of people have already created many, many symbols files for Inkscape (I've even downloaded and installed a few). Moini might know?

Edit
Inkscape also has Glyphs (Text menu). Unfortunately, I don't know much about those. And more unfortunately, the manual may not be current on the subject of glyphs or symbols, either one. But we'll try to fill in the gaps, as much as possible. Just keep asking questions :D

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Best Inclusion Methods

Postby kstingel » Thu Feb 18, 2016 8:24 pm

Moini wrote:Does that work?... I think currently you can only add patterns to the standard patterns file (at least that was the only thing that worked for me).

Also see http://www.silent9.com/blog/archives/14 ... scape.html
and
viewtopic.php?t=493

The Inkscape:collect thing is needed, I also don't know what it means.


sadly, no it didn't work ... Inkscape crashed each time I tried to add my patterns - possibly because of the different file name, I didn't consider that

I'll retry and see if it will pick up the file from my user settings if I rename it to patterns.svg.
If all else fails, I'll backup the original file and paste my new Patterns at the bottom of the current file - keeping a backup "clean" version of my stuff so I can pull it out again once I finish the project ... and so I can replace it if it get's overwritten by updates :D

I checked out the links, you suggested .... they were good for diagnosing the pattern creation - pretty much confirmed the steps I've been taking are correct. But they didn't help with Symbols :?

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Best Inclusion Methods

Postby kstingel » Thu Feb 18, 2016 8:48 pm

brynn wrote:Well, this is all a bit over my head. But I just wanted to mention Object menu > Symbols. You can create your own custom symbols. And you can create a symbols file that's available in any of your Inkscape files. I don't know how to create a finished file like that, but I know it can be done. A lot of people have already created many, many symbols files for Inkscape (I've even downloaded and installed a few). Moini might know?

Edit
Inkscape also has Glyphs (Text menu). Unfortunately, I don't know much about those. And more unfortunately, the manual may not be current on the subject of glyphs or symbols, either one. But we'll try to fill in the gaps, as much as possible. Just keep asking questions :D


I've started tinkering with Symbols, but every time I drop the symbol into the image, it's huge. I have been bringing them back down to size by hacking the XML ... for some reason Inkscape imports them @ width & height 100% instead of the defined Symbol size

Code: Select all

<symbol id="mainHall" width="60" height="60" viewBox="0 0 60 60" preserveAspectRatio="xMinYMin meet">
      <rect id="obj-fill" class="fill-mh" x="0" y="0" width="60" height="60" />
      <path id="obj-stroke" class="stroke-mh" transform="translate(0.5)" d="M 0,0 59,0 59,59 0,59 Z" inkscape:connector-curvature="0" data-title="Elven Main Hall" />
    </symbol>

since the version 1.1 specs don't actually contain the stroke-alignment property, I emulated it by breaking the path away from the fill ... it also gets around the problem of browsers not yet supporting version 2 capabilities :D


It took me a while to figure out that I needed to set the fill and stroke opacity on the container layer to "0" so that my classes showed through

My "Layer" group takes the class="building" attribute, so I don't need to repeat common styles for each object


I also have a "Symbols" layer which is hidden by default - I originally drew the object there, then used the stylesheet extension to pull the styles out to the XML then tidied it up with Notepad++


:idea: I'm starting to wonder if I wouldn't be better served to just have my pseudo Symbols layer and clone the object from there. I haven't got the gist of Cloning yet

Off topic:
Once I get it all sorted, I'll write up a tutorial outlining the steps taken to achieve the end results - and give you all Kudos for all your help

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

Re: Best Inclusion Methods

Postby brynn » Fri Feb 19, 2016 1:03 am

By the way, what kind of project is this? Or did you already say, and I missed it? Just link me to the message, if you already said.

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Best Inclusion Methods

Postby kstingel » Fri Feb 19, 2016 5:10 pm

I'm drawing optimized layouts for each expansion block in Elvenar

Starting with the initial map, and laying out the buildings (roads, decorations, etc) to best use the available space

that way when I start a new world, I can build my city fully optimized from the get go

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Best Inclusion Methods

Postby Moini » Sat Feb 20, 2016 2:17 am

(Elvenar is a game using isometric perspective, AFAIU. It's (in part) about cities and see them grow)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
kstingel
Posts: 62
Joined: Fri Feb 12, 2016 3:27 pm

Re: Best Inclusion Methods

Postby kstingel » Sat Feb 20, 2016 9:04 pm

After I create a master page which has my template buildings translated so they are off the viewport ...
If I then create my map(s) and run cleanup to optimize the document, will the stuff outside the viewport get scrapped?

Am just asking so I know the best way to save each Species Map set

At this stage, am creating the master page with all the different buildings
copy/pasting the template building into the "page" area and doing a "Save as ..."

alternate method would be to create each Species Map as a layer so I can toggle visibility,
then copy/paste each visible map into a new document - I'm assuming that if I went that way, only those parts that are actually visible would be transferred to the new file

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Best Inclusion Methods

Postby Moini » Sun Feb 21, 2016 1:40 am

Cleanup document removes unused defs, so it might be - depending on where you save the things you don't want to be visible.
You could just try out what exactly happens using a copy of the document.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”