Inkscape scripting
by Steve Litt
Hi all,
File->Document_properties->Scripting_tab
I've looked all over the web and all through my help->user manual and
can't find anything about this. For one thing, I need to know how to
give an embedded script a human-friendly name. I also need to know what
to put in the content: Is it Javascript, and how does it differ from
html based Javascript.
Anyone know of any documentation on this? Theoretically, I could creat
a very simple clickable map exclusively in <svg>, without the
containing <html>.
Thanks,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
Awk SVG insertion scripts
by Steve Litt
Hi everyone,
My experimentation tells me that life's much easier if I put the <svg/>
element and all it contains in my HTML file, rather than trying to
import it with <img/> or <object/>. So I made the following scripts to
put the <svg> part of a (presumably Inkscape created) SVG file into an
HTML file wherever the following is located:
<div class="token">myfile.svg</div>
Be sure to use doublequotes around "token": These are simple scripts.
Script 1: insertsvg.awk myfile.html
Script 2: justsvg.awk mysvg.svg
Let's say these two Awk files were executable and on the path. In your
myfile.html, place the following line (alone on its line) where you
want the <svg/> element to be inserted:
<div class="token">mysvg.svg</div>
Now, assuming myfile.html and mysvg.svg are both in the current
directory, just do the following:
./insertsvg.svg myfile.html > myfile_complete.html
Now myfile_complete.html no longer has the div.token, but in its place
has the entire <svg/> element from mysvg.svg.
This means when you include your Inkscape built SVGs in HTML files,
theres an easy automated way to do it without having to resort to cut
and paste.
And now for the scripts:
/* ======= insertsvg.awk ==============*/
#!/usr/bin/gawk -We
{printthisline = 1}
/<div\s\s*class="token"\s*>\s*[^<]*\s*<\/div>/{
printthisline = 0
svgfile = \
gensub(/\s*<div\s\s*class="token"\s*>\s*([^<]*)\s*<\/div>\s*/, \
"\\1", "1")
system("./justsvg.awk " svgfile)
}
printthisline == 1 {print}
/* ======= justsvg.awk ==============*/
#!/usr/bin/gawk -We
BEGIN {insvg = 0}
/\s*<svg/ { insvg = 1 }
insvg == 1 { print }
/\s*<\/svg\s*>/ { insvg = 0; exit 0 }
HTH,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
Path->Inset too big
by Steve Litt
Hi all,
Path->Inset slightly pulls back the edges of a path. It shaves a tiny
bit off the edges of the path. Path->Outset does the opposite: It moves
the edges a little bit outward. Neither is a proportional grow or
shrink.
Anyway, I'm trying to apply Path->Inset to a bunch of objects very
close to each other, just to give a little more visible separation. The
trouble is, I can't find an adjustment for how much you want to inset,
and even one application of Path->Inset trims off far too much from the
edge.
Does anyone know how to set the amount that gets taken away from the
edge when you Path->Inset?
Thanks,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
A few comments on making clickable SVG in Inkscape
by Steve Litt
Hi all,
I just finished making a clickable SVG in Inkscape, embedding the
<svg/> in an HTML file, and verifying that it works. Much of it is
obvious, so let me start with the unobvious stuff first:
If, for convenience, you use Ctrl+D to dup shapes, I think they're all
clones of the first one. You need to de-clone them. But you're not done
yet...
Shapes in Inkscape have a tenacious habit of reverting their ID and
label to Inkscape-assigned values rather than the values you assign in
object->property. Make your last two steps decloning and manually
setting the ID and label, and BE SURE TO CLICK THE SET BUTTON OR
THEY'LL REVERT.
Your events go in the area uncovered when you object->properties and
then click "Interactivity". Each possible event is listed, and all you
do is put in the javascript you want executed on that event. Don't wrap
the Javascript in doublequotes.
SIZING THE DRAWING
------------------
Be SURE that your leftmost object's leftmost portion is at X value 0.
Make sure your bottommost object's bottommost portion is at Y value 0.
Note that in Inkscape, at least until they change it a few versions
from now, Y=0 is at the bottom of the page, not at the top.
When you're done drawing, once again line up the left with X=0 and the
bottom with Y=0, select everything, do the following:
* File->Document_properties
* Resize page to drawing or selection
* Note that the height and width changed when you did the preceding.
* Add double the desired image padding to both height and width.
(I added 2mm to each)
* Select everything on the drawing, and move slightly so it's centered
within the page.
* Save the document, you're done with sizing.
Be aware that if the lower left of your document isn't anchored to x=0,
y=0, clicking will be off or not happen.
HTH,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
Inkscape Borked :(
by Abrolag
I've just got around to updating my main machine from debian jessie to stretch
(I only ever do this when a release freeze is well established) and it's fine
for everything except Inkscape.
Existing files are all over the place - especially where text is concerned,
and trying to change a font in any way causes Inkscape to freeze.
I tried to compile an older version but configure doesn't seem to recongnise
libraries that are installed (yes I included .dev) or calls for ones that I
can't find anywhere.
debian has no fall-back system so it would seem the only solution would be to
scrap the entire install and go back to jessie. This is something I *really*
don't want to do.
--
W J G
6 years, 5 months
The SVG blues
by Donn Ingle
Seems SVG is more and more invisible to the big companies. Here's sad tale
of Amelia Bellamy-Royds's experiences with SVG and its seeming demise.
(http://codepen.io/AmeliaBR/post/me-and-svg)
I wonder how the Inkscape devs (et al.) feel about this. Could Inkscape not
take a new route, perhaps bake-in some new features*, now that the SVG
standards seem to be moot?
*
Multiple pages in one file — and export to multi-page PDFs.
A real symbol system — within and *between *documents.
Custom colours that don't rely on that fake gradient trick (And make them
work between documents too!)
Animation time lines.
Output to gif, video and so forth. Perhaps to HTML5 Canvas with some js
framework too.
Scripting, Blender-style, right there in the app. In Python and JS perhaps.
Opening of Gimp native files (xcf) into layers, perhaps.
Use of 3D objects and materials, from Blender (say) directly in the canvas
— some kind of OLE layer thing.
I am sure there are many more.
I think Inkscape could have, by now, matched what Flash, Freehand and Corel
et al. had 20 years ago! It did not go there because it, honourably, stuck
to the SVG standards.
Inkscape is the best thing we have for graphic design on Linux (at least),
but it's still way too primitive. Could we dare to think bigger? Start our
own standard?
Just wondering. Is this a disaster or an opportunity?
/d
6 years, 5 months
When to use onclick(evt) and when to use onclick(event)?
by Steve Litt
Hi all,
Within a <svg> element in my HTML body, I can use onclick(evt), as
exemplified below:
============================================================
<svg width="500px" viewBox="0 15 80 30">
<circle id=circ1 r="6" cx="10" cy="30" onclick="top.doit(evt)" />
</svg>
============================================================
I can change the "evt" to "event" and it still works, but if I change
it to anything else, for example "e", it fails. Is evt some kind of
reserved word within SVG?
By the way, if an item in HTML itself (like a paragraph) has an
onclick, you need to remove the "top." and only "event" will work.
I have the rudiments of a clickable map using SVG, CSS and Javascript,
and am starting to build it into something useful.
Thanks,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
Clickable SVG map
by Steve Litt
Hi all,
I've read that, when making an HTML page with a clickable map (a map of
the states in America, for instance), it's very doable in SVG. Has
anybody done this? If so, did you need to copy and paste the svg code
into the HTML, or were you able to work from an image imported with the
<img src="mymap.svg"/> tag?
Did you need to do something to tell the CSS in your HTML doc's head
that you meant #rect1234 in the <css> tree? Does anyone know of a
document that unambiguously tells exactly how to do it?
Thanks,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
6 years, 5 months
Clickable measurements
by Susan Spencer
Use this for measurements
On Apr 23, 2017 23:24, <inkscape-user-request(a)lists.sourceforge.net> wrote:
Send Inkscape-user mailing list submissions to
inkscape-user(a)lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/inkscape-user
or, via email, send a message with subject or body 'help' to
inkscape-user-request(a)lists.sourceforge.net
You can reach the person managing the list at
inkscape-user-owner(a)lists.sourceforge.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Inkscape-user digest..."
Today's Topics:
1. Clickable SVG map (Steve Litt)
2. Re: Clickable SVG map (Martin Owens)
3. Re: Clickable SVG map (Victor Westmann)
4. Re: Clickable SVG map (Steve Litt)
5. Re: Clickable SVG map (C R)
6. Re: Clickable SVG map (C R)
----------------------------------------------------------------------
Message: 1
Date: Mon, 24 Apr 2017 00:38:35 -0400
From: Steve Litt <slitt@...2357...>
Subject: [Inkscape-user] Clickable SVG map
To: inkscape-user(a)lists.sourceforge.net
Message-ID: <20170424003835.552d6f01@...3217...>
Content-Type: text/plain; charset=US-ASCII
Hi all,
I've read that, when making an HTML page with a clickable map (a map of
the states in America, for instance), it's very doable in SVG. Has
anybody done this? If so, did you need to copy and paste the svg code
into the HTML, or were you able to work from an image imported with the
<img src="mymap.svg"/> tag?
Did you need to do something to tell the CSS in your HTML doc's head
that you meant #rect1234 in the <css> tree? Does anyone know of a
document that unambiguously tells exactly how to do it?
Thanks,
SteveT
Steve Litt
April 2017 featured book: Troubleshooting Techniques
of the Successful Technologist
http://www.troubleshooters.com/techniques
------------------------------
Message: 2
Date: Mon, 24 Apr 2017 00:58:27 -0400
From: Martin Owens <doctormo@...155...>
Subject: Re: [Inkscape-user] Clickable SVG map
To: Inkscape User Community <inkscape-user(a)lists.sourceforge.net>
Message-ID: <1493009907.13767.9.camel@...155...>
Content-Type: text/plain; charset="UTF-8"
I did this many years ago if's an interesting example for you:
http://divajutta.com/doctormo/locomap/map.svg
But there are lots of svg maps these days. Leaflet does a fairly good
job of showing a map which can be constructed from svg paths, you can
choose to have open street map tiles or not.
Best Regards, Martin Owens
On Mon, 2017-04-24 at 00:38 -0400, Steve Litt wrote:
> Hi all,
>
> I've read that, when making an HTML page with a clickable map (a map
> of
> the states in America, for instance), it's very doable in SVG. Has
> anybody done this? If so, did you need to copy and paste the svg code
> into the HTML, or were you able to work from an image imported with
> the
> <img src="mymap.svg"/> tag?
>
> Did you need to do something to tell the CSS in your HTML doc's head
> that you meant #rect1234 in the <css> tree? Does anyone know of a
> document that unambiguously tells exactly how to do it?
>
> Thanks,
>
> SteveT
>
> Steve Litt?
> April 2017 featured book: Troubleshooting Techniques
> ?????of the Successful Technologist
> http://www.troubleshooters.com/techniques
>
> -------------------------------------------------------------------
> -----------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-user mailing list
> Inkscape-user(a)lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/inkscape-user
------------------------------
Message: 3
Date: Sun, 23 Apr 2017 22:07:55 -0700
From: Victor Westmann <victor.westmann@...155...>
Subject: Re: [Inkscape-user] Clickable SVG map
To: Inkscape User Community <inkscape-user(a)lists.sourceforge.net>
Message-ID:
<CAPOH7=amxU8mZw-EVLr3AbN1=vQ1cLWhO8uwLjHHaFtCQF-2iw@...156...>
Content-Type: text/plain; charset="utf-8"
Hi,
This is really cool. Do we have a map sample on inkscape website? I mean...
can we promote our tool as an app that does this?
Do you guys think more people would be interested?
On Apr 23, 2017 10:00 PM, "Martin Owens" <doctormo@...155...> wrote:
> I did this many years ago if's an interesting example for you:
>
> http://divajutta.com/doctormo/locomap/map.svg
>
> But there are lots of svg maps these days. Leaflet does a fairly good
> job of showing a map which can be constructed from svg paths, you can
> choose to have open street map tiles or not.
>
> Best Regards, Martin Owens
>
> On Mon, 2017-04-24 at 00:38 -0400, Steve Litt wrote:
> > Hi all,
> >
> > I've read that, when making an HTML page with a clickable map (a map
> > of
> > the states in America, for instance), it's very doable in SVG. Has
> > anybody done this? If so, did you need to copy and paste the svg code
> > into the HTML, or were you able to work from an image imported with
> > the
> > <img src="mymap.svg"/> tag?
> >
> > Did you need to do something to tell the CSS in your HTML doc's head
> > that you meant #rect1234 in the <css> tree? Does anyone know of a
> > document that unambiguously tells exactly how to do it?
> >
> > Thanks,
> >
> > SteveT
> >
> > Steve Litt
> > April 2017 featured book: Troubleshooting Techniques
> > of the Successful Technologist
> > http://www.troubleshooters.com/techniques
> >
> > -------------------------------------------------------------------
> > -----------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Inkscape-user mailing list
> > Inkscape-user(a)lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-user mailing list
> Inkscape-user(a)lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
6 years, 5 months