math error in inkex.py function "uutounit"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Inkscape 0.91 r13725
Window10 64-bit
Just on naive use, it looks like the inkex.py function "uutounit()" defined in line 359 of the inkex.py which came with inkscape 0.91 might have a simple math error:
Seems that it should be:
def uutounit(self, val, unit):
return val * (self._
instead of:
def uutounit(self, val, unit):
return val / (self._
(difference being only the multiplication instead of division...)
Given code in extension:
#start of code
import inkex
#SVG element generation routine
def draw_SVG_
style = { 'stroke' : 'none',
}
attribs = {
'style' : simplestyle.
'height' : str( inkex.Effect.
'width' : str(inkex.
'x' : str(x),
'y' : str(y)
}
circ = inkex.etree.
draw_SVG_
# end of code
Expected: a square 10mm per side if documents units are in px.
Observed: a square of 0.796 mm.
confirmation: changing the inkex.py function as above results in the expected 10.0mm square. caveat: I am not a good coder though.
Hi there, I don't think this is a bug.
uutounit is meant to convert document units to your chosen unit. So if the document unit was inches, self.uutounit(10, 'mm') would return 254, which is the equivalent size in mm.
Please let me know if I am mistaken or if you have any other questions. Thank you!