OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Remove Mirror form All Selected Text (http://forum.oberonplace.com/showthread.php?t=5975)

vindaa 11-07-2008 20:34

Remove Mirror form All Selected Text
I have several Artistic Text rotated at different angle in a drawing. Now when I mirror the drawing the text is also mirrored. So how can I remove the mirror while preserving the new rotation angle (all the mirrored text is in different layer so selecting all the mirrored text at once would be easy)

Since I dont konw vb what I tried is

Sub RimoveMirror()

Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
RAng = OrigSelection.RotationAngle

Dim dup1 As ShapeRange
Set dup1 = OrigSelection.Duplicate()

dup1.RotationAngle = RAng
End Sub

I thought that I will duplicate the selected text -- apply clear transformation to the duplicated text and ask it to copy rotation angle from the original selection and delete the original selection. But I am getting nowhere.

shelbym 11-07-2008 23:24

Try this...
You almost have it and are on the right track...basically you need to.

1. Find all the text objects
2. Get their rotation angles
3. Mirror each piece of text back
4. Set the rotation angle back adjusting for the mirror*

*If you take a normal piece of text, horizontally mirror it look at the rotation angle it is 180 degrees. So when we set the angle back we have to adjust for this shift. Hope that make sense. Do you code might look something like this.

Sub FixText()
    Dim s As Shape
    Dim dblRotate As Double
    Optimization = True 'Stop the screen for redrawing (aka speed up the macro)
        For Each s In ActivePage.Shapes.FindShapes(Type:=cdrTextShape) 'Find all the text objects
            dblRotate = s.RotationAngle 'Get the angle of the shape
            s.Flip cdrFlipHorizontal 'Flip the shape back
            s.RotationAngle = dblRotate - 180 'Set the angle adjusting for the horizantal mirror shift
        Next s
    Optimization = False 'Turn screen redrawing back on
    ActiveWindow.Refresh 'Refresh the window
    Application.Refresh 'Refresh the Application
End Sub

Hope I got it right and it helps!


vindaa 12-07-2008 19:47

Hi Shelbym Thanks once again, This saves lot lot of time.
I just changed ActivePage to ActiveSelection. Since otherwise it mirrored the non mirrored text also.

Thanks a lot.

All times are GMT -5. The time now is 04:23.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com