Inkscape.org
Creating New Extensions Difficulties adding transforms to existing objects
  1. #1
    inklinea inklinea @inklinea⛰️
    *

    I'm a bit stuck on adding new transforms to existing objects which already have transforms.

    What I really want to do is add a translate to an existing object, with an x, y direction relative to the page axis rather than relative to the transformed object coordinate system.

    I have been cheating, wrapping the existing object in a group, then simply using new_group.transform.add_translate(20, 30) for example.

    Otherwise for example if I have an object with translate(rotate(45)), when I multiply object.transform * Transform('translate(20, 0)')

    The object moves in the diagonal direction as you might expect. 

    Is there an easy way to do this without cheating, and without getting into dissecting the transform order ? 

    Many Thanks.

     

  2. #2
    inklinea inklinea @inklinea⛰️

    Well I managed to find an outrageous workaround.

     

    Wrap the object in a new group

    Apply a transformation to the group

    Get the composed_transform() for the object whilst still in the group.

    Move the object into it's original layer

    Apply the composed transform to the object.

    Delete the new group.

     

     

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Difficulties adding transforms to existing objects