AB4D Forum

Full Version: TransformShapes not working as expected
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey ReadSvg Folks,

I have Visio files I'm exporting to SVG and using Ab2d.ReaderSvg() to convert the file to XAML.  It appears if a Visio "square" with FlipX is set to True, the square is not rendered correctly when the TransformShapes option is set to True.

I have attached a zip file with the original Visio file, VisioToSvg.vsdx, the Visio export svg file, VisioToSvg.svg as well as the Xaml files with TransformShapes enabled/disabled.

[attachment=164]

When TransformShapes is Enabled you will see the square overlaps the circle to the right.  The square should be in between the two circles.

Let me know if there is something I need to tweak on my end.

Cheers!

Troy
TransformShapes cannot work all the time - for example if you apply a rotation by 30 degrees to the Rectangle, then it is not possible to define the rotated Rectangle without a transformation. But because this option removes the transformations, then the Rectangle will not be correct.

In your case you are using -1 for ScaleX. I tried to support this special case but in the very limited time that I had I was not able to do that. Also, this would support only a few special cases (where ScaleX or ScaleY is -1).

Therefore I would ask you to update your svg file so that you do not use negative scale values.
Thanks for the response.

Just, FYI, for my clients this is not a special case, thousands Visio drawings with shapes with FlipX true. It's one of the shortcuts we train them to use, maybe we should update our training, haha!

Anyway, with my current tests, removing the scale(-1,1) from the Visio exported SVG file seems to resolve the issue.  I'll add some prepossessing on these files to remove scale(-1,1) before running them through Ab2d.ReaderSvg.Read, see if anything else pops up.

BTW, ReaderSvg and PowerTools have been great to use and have saved me a ton of time.

Cheers!

Troy
Hey All,

For completeness, figured I'd post how I resolved this.  Before exporting the Visio document to SVG, I iterate over each of the Shapes in the page and check FlipX.  If true, I set it to false and rotate the shape 180 degrees.  Results in the same rendering, but the ReaderSvg resolves the transform with TransformShapes = true.

Cheers!

Troy
Great! Troy, I am glad that you solved this issue!