Inkscape.org
Creating New Extensions Retain the 5 digits after the decimal points
  1. #1
    czkPanda czkPanda @czkPanda

    My original path data 'd' has 5 digits after the decimal points but after I applied the path.to_relative(), the path data rounded to 3 digits after the decimal points. I was wondering if it is possible to retain the 5 digits after the decimal points when converting the d using path.to_relative() or path. to_absolute functions. 

    Thanks!

  2. #2
    czkPanda czkPanda @czkPanda

    I just noticed that I have posted multiple same posts, I didn't mean to do that. Sorry for it!

  3. #3
    inklinea inklinea @inklinea⛰️

    I'm not sure about that one, I think it comes from Vector2d()

    You would have to ask that question in https://chat.inkscape.org/channel/inkscape_extensions

  4. #4
    czkPanda czkPanda @czkPanda

    Thanks, should I ask the questions in the channel of team_vector? 

  5. #5
    inklinea inklinea @inklinea⛰️

    No, the link above, 'inkscape_extensions'

  6. #6
    inklinea inklinea @inklinea⛰️

    Okay, doctormo and joneuhauser answered in the chat :) -  Many thanks.

    The answer is to set the inkex number template

    https://inkscape.gitlab.io/extensions/documentation/source/inkex.paths.html?highlight=number_template#inkex.paths.PathCommand.number_template

    for path_object in selection_list:
        inkex.paths.PathCommand.number_template = '{:.2f}';
        inkex.errormsg(path_object.path.to_absolute())
        inkex.paths.PathCommand.number_template = '{:.6f}';
        inkex.errormsg(path_object.path.to_relative())

    If you type "python number template" into google, there are lots of examples of different number template settings - not sure if all are supported :)

  7. #7
    czkPanda czkPanda @czkPanda

    Thanks!

     

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Retain the 5 digits after the decimal points