Page size changes output position
xxv opened this issue · comments
Changing the page size in Inkscape changes the output position of the diagram.
- Create a diagram with a 100x100 square (size is arbitrary) at position 0,0
- File -> Document Properties -> Custom Size -> Resize page to content
Expected output:
3. DXF export square is loaded at 0,0 in OpenSCAD
Actual:
3. DXF export square is at another location
Inkscape version 0.92 in Debian
OpenSCAD 2015.03-2
@xxv Yes, that is a know issue. Thanks for adding it here. I have worked around it by copy/pasting to a new document, though I realize that's not a great option for a complex document.
This is caused by a kind of strange behavior of Inkscape which for some reason translates the layer group on resize.
In https://github.com/brad/Inkscape-OpenSCAD-DXF-Export/blob/master/openscad_dxf/openscad_dxf.py#L203 there is a check if the path itself has a translate property. Maybe another check for the group translate can solve this problem:
layer_transform_string = node.getparent().get('transform')
if layer_transform_string is not None:
layer_transform = simpletransform.parseTransform(layer_transform_string)
simpletransform.applyTransformToPath(layer_transform, p)
Any update on this? I'm seeing this behavior and it's ruining my ability to make something symmetric within OpenSCAD...
Sorry @ubiquitous42 , I am not working on this actively anymore but will happily accept a PR to fix it