Dimensions in extensions

Discussion about writing code for Inkscape.
tomate
Posts: 2
Joined: Fri Aug 12, 2011 7:26 pm

Dimensions in extensions

Postby tomate » Fri Aug 12, 2011 7:48 pm

Hi,
First, I would like to thank all Inkscape coders and contributors. This is a real good software and I use it a lot. Thanks, guys !

I am currently trying to code my first Inkscape extension, that generates a guitar fingerboard.
I have two questions about dimensions.

1 - In the input fields, I only have one digit after the decimal point. Is it possible to have two or more digits ?
2- In the main Inkscape interface, the dimensions and position of an object are automatically converted, when switching from one unit to another. Is it possible to get the same kind of behaviour in an extension ?

Thanks for your help.

Tomate

tomate
Posts: 2
Joined: Fri Aug 12, 2011 7:26 pm

Re: Dimensions in extensions

Postby tomate » Sat Aug 13, 2011 7:43 pm

I found how to specify the number of digits after the decimal point, by adding precision="number_of_digits" in the .inx entries.
Any answer for the second question ?
Thanks,
Tomate

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

Re: Dimensions in extensions

Postby brynn » Sun Aug 14, 2011 8:10 am

Hi Tomate,
Image
Welcome to InkscapeForum!

I can't answer your question, unfortunately. But I wanted to let you know that relatively few of our members will know the answer, and who probably don't visit the forum every day. I'm confident that someone will know, it just might not happen right away. So I just want say hang in there :( And welcome :D

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Dimensions in extensions

Postby ~suv » Sun Aug 14, 2011 3:02 pm

tomate wrote:2- In the main Inkscape interface, the dimensions and position of an object are automatically converted, when switching from one unit to another. Is it possible to get the same kind of behaviour in an extension ?

AFAIU not automatically, you have to take care of the conversion yourself in the python script - see for example the 'Visualize Path > Measure Path…' extension, which allows to select a unit in the extension dialog and does the conversion accordingly (using a helper function from 'inkex.py': unittouu()).


Return to “Programming”