On Thu, 02 Jul 2009 10:39:45 +0200
Maarten van der Velde <Maarten.van-der-Velde@...> wrote:
> So, basically, if I'd want to get information from the underlaying
> drawing (like the coordinates of a node), I'd have to do XML
> operations? Like finding an attribute and it's value, etc?
For a node, yes.
Some python extensions actually call another instance of inkscape on
the current file, using the --query-all flag which makes inkscape dump
id,x,y,w,h (i.e. bounding box) for all objects, something you can't
really do just parsing the XML, on account of possible layered
transformations.
Cheers -Terry

Maarten van der Velde wrote:
>> I'm still wishing for a model by which we have access to the living
>> inkscape internals and access to draw with all of those tools in python.
>
> Yes, that was what I was hoping for. A bit like in Blender, maybe.
> Programmig in Python there is surprisingly straight-forward, compared to
> its´ user-interface :) I guess people would create a lot more "effects" if
> there was a simple and straightforward way of saying things like:
>
> x=selection.drawingNode[3].x
>
> or
>
> myBezier.addDrawingNode(myNewNode)
Keep going! It would be very helpful to your cause if you could start a
page on the Wiki to design the API you seek. Implementation is probably
pretty easy here, I think it is the API design part that is holding
people back.
Aaron Spike

Hey everybdoy,
Thanks for your replies.
So, basically, if I'd want to get information from the underlaying drawing
(like the coordinates of a node), I'd have to do XML operations? Like
finding an attribute and it's value, etc?
> http://www.programmer-art.org/projects/svg-utils
I'll have a look!
>
> I'm still wishing for a model by which we have access to the living
> inkscape internals and access to draw with all of those tools in python.
Yes, that was what I was hoping for. A bit like in Blender, maybe.
Programmig in Python there is surprisingly straight-forward, compared to
its´ user-interface :) I guess people would create a lot more "effects" if
there was a simple and straightforward way of saying things like:
x=selection.drawingNode[3].x
or
myBezier.addDrawingNode(myNewNode)
Kind regards,
Maarten
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
http://www.powel.no
**********************************************************************

I just realized we should probably mention that Ted and I are being
interviewed today on FLOSS Weekly in regards to Inkscape.
http://twit.tv/floss
It will be streamed live today at 1:30pm on http://live.twit.tv/ but
then will go out on the FLOSS Weekly podcast. That usually goes up
around the weekend.
Hopefully we can bring a bit of attention for Inkscape, the new
release, and just possibly interest a few more users to come in and
help with final 0.47 testing and bug fixing.

Maarten van der Velde wrote:
> I'd like to write a Python script in Inkscape, but I cannot find something
> like a straightforward "API" or something. I have seriously Googled quite a
> bit on it, but everything looks horribly complicated. Is there a
> straightforward way for creating a line from A to B, for example? Or does
> everything I want to do in Python require some complicated XML handling?
A number of people have proposed building a drawing API on top of the
current xml handling base, but no one has followed through. You might be
able to save some effort if you merge with svg-utils:
http://www.programmer-art.org/projects/svg-utils
I'm still wishing for a model by which we have access to the living
inkscape internals and access to draw with all of those tools in python.
Aaron Spike

All interaction with the svg involves the XML representation. In you
example, to create a new line you would add a bezzier curve objext
into the DOM. (I think that is the right term). Fortunately, the xml
handling code is available in python. Check out existind scripts for
examples.
-Rob A>
On 7/1/09, Maarten van der Velde <Maarten.van-der-Velde@...> wrote:
> Hey,
>
> I'd like to write a Python script in Inkscape, but I cannot find something
> like a straightforward "API" or something. I have seriously Googled quite a
> bit on it, but everything looks horribly complicated. Is there a
> straightforward way for creating a line from A to B, for example? Or does
> everything I want to do in Python require some complicated XML handling?
>
> Thanks,
>
> Maarten
>
>
> On 6/30/09 12:16 PM, "Jasper van de Gronde" <th.v.d.gronde@...> wrote:
>
>> And please be sure to file a bug/feature request at
>> http://bugs.launchpad.net/inkscape/
>>
>> In the end there will obviously always be cases where Inkscape is too
>> slow, but Inkscape could most definitely be faster in some cases. And
>> just locking/unlocking the layer should (from an intuitive standpoint)
>> NOT cause such a big pause.
>>
>> Dave M G wrote:
>>> Donn,
>>>
>>> Thank you for responding.
>>>
>>>> I have long moaned that "Nodes mean slow" :( I have a fast machine and
>>>> 2gigs
>>>> of RAM. It makes no difference. I think it's all the looping through
>>>> those
>>>> long
>>>> lists of nodes....
>>>>
>>>> You are doomed. Unless you can simplify or chop-up your comic page into
>>>> frames
>>>> and assemble them later in Gimp.
>>>
>>> Okay. While it's a little disappointing that there isn't a way to
>>> optimize the file for better performance, it's good to know that at
>>> least I'm not doing something wrong.
>>>
>>> I'll export the paths into a PNG and handle the colouring in Photoshop
>>> or GIMP. It means committing to rasterizing the images sooner in my
>>> process than I had hoped, but hey, life is full of compromises.
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Inkscape-user mailing list
>> Inkscape-user@...
>> https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
>
>
> ________________________________________________________________
> Maarten van der Velde
> graphic designer
>
> Powel ASA Klæbuveien 194, NO-7037 Trondheim, NORWAY
> Phone: +47 73 80 45 00 - Fax: +47 73 80 45 01
> Direct line: +47 73 80 46 21 - Mobile: +47 48 16 46 21 / +31 (0) 6 30 80
> 95 91
> Email: Maarten.van-der-Velde@...
> http://www.powel.com/
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> http://www.powel.no
> **********************************************************************
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Inkscape-user mailing list
> Inkscape-user@...
> https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
--
Sent from my mobile device

Hey,
I'd like to write a Python script in Inkscape, but I cannot find something
like a straightforward "API" or something. I have seriously Googled quite a
bit on it, but everything looks horribly complicated. Is there a
straightforward way for creating a line from A to B, for example? Or does
everything I want to do in Python require some complicated XML handling?
Thanks,
Maarten
On 6/30/09 12:16 PM, "Jasper van de Gronde" <th.v.d.gronde@...> wrote:
> And please be sure to file a bug/feature request at
> http://bugs.launchpad.net/inkscape/
>
> In the end there will obviously always be cases where Inkscape is too
> slow, but Inkscape could most definitely be faster in some cases. And
> just locking/unlocking the layer should (from an intuitive standpoint)
> NOT cause such a big pause.
>
> Dave M G wrote:
>> Donn,
>>
>> Thank you for responding.
>>
>>> I have long moaned that "Nodes mean slow" :( I have a fast machine and 2gigs
>>> of RAM. It makes no difference. I think it's all the looping through those
>>> long
>>> lists of nodes....
>>>
>>> You are doomed. Unless you can simplify or chop-up your comic page into
>>> frames
>>> and assemble them later in Gimp.
>>
>> Okay. While it's a little disappointing that there isn't a way to
>> optimize the file for better performance, it's good to know that at
>> least I'm not doing something wrong.
>>
>> I'll export the paths into a PNG and handle the colouring in Photoshop
>> or GIMP. It means committing to rasterizing the images sooner in my
>> process than I had hoped, but hey, life is full of compromises.
>>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Inkscape-user mailing list
> Inkscape-user@...
> https://lists.sourceforge.net/lists/listinfo/inkscape-user
________________________________________________________________
Maarten van der Velde
graphic designer
Powel ASA Klæbuveien 194, NO-7037 Trondheim, NORWAY
Phone: +47 73 80 45 00 - Fax: +47 73 80 45 01
Direct line: +47 73 80 46 21 - Mobile: +47 48 16 46 21 / +31 (0) 6 30 80
95 91
Email: Maarten.van-der-Velde@...
http://www.powel.com/
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
http://www.powel.no
**********************************************************************