Some texts get mirrored during conversion from Rhino to Autocad

Some texts get mirrored during conversion from Rhino to Autocad. Could you please tell me how to solve this problem? I have attached a screenshot of the problem.

Hi @MARUF ,
I suspect that the issue is that in Rhino you have this selected:

If you unselect it you’ll see the ‘actual’ orientation of the text. Looking at your image, you most probably have mirrored the left-side text. You can manually rotate then correctly (if there’s a reasonable amount). If there are too many, then I have this small python script that could be helpful. It’s fastly written, and probably contains bugs, but it’s a step in the right direction.

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc


def FlipText():

    objectId = rs.GetObject("Select txt object", rs.filter.annotation)
    if objectId is None: return
    
    pln = rs.TextObjectPlane(objectId)
    if pln[3][2] < 0:
        #rotate plane & text
        pln2 = rs.RotatePlane(pln, 180, pln[2])
        rs.TextObjectPlane(objectId, pln2)
        set_justifiction(objectId)

        
    
def set_justifiction(text_id):
    #grab geometry of the text object
    text_geometry = rs.coercegeometry(text_id)
    curJ = rs.coercegeometry(text_id).Justification
    #flip justification
    if (str(curJ) == 'TopLeft'): 
        newJ = Rhino.Geometry.TextJustification.TopRight
    if (str(curJ) == 'TopRight'): 
        newJ = Rhino.Geometry.TextJustification.TopLeft
    if (str(curJ) == 'MiddleLeft'): 
        newJ = Rhino.Geometry.TextJustification.MiddleRight
    if (str(curJ) == 'MiddleRight'): 
        newJ = Rhino.Geometry.TextJustification.MiddleLeft
    if (str(curJ) == 'BottomLeft'): 
        newJ = Rhino.Geometry.TextJustification.BottomRight
    if (str(curJ) == 'BottomRight'): 
        newJ = Rhino.Geometry.TextJustification.BottomLeft
        
    #replace geometry of the rhino object with new justification geometry
    text_geometry.Justification = newJ
    sc.doc.Objects.Replace(text_id,text_geometry)


# Check to see if this file is being executed as the "main" python
# script instead of being used as a module by some other python script
# This allows us to use the module which ever way we want.
if __name__ == "__main__":
    FlipText() # Call the function defined above
1 Like

Hi -

We have that issue on our list as RH-67110. For now, you’ll have to make sure that the text is oriented correctly in Rhino without using the “Text reads backward when viewed from behind” option that Toni mentioned. Or use the script…
-wim

1 Like

Is there a way to select multiple texts at a time?

@MARUF
Hi, I restructured the script a bit, so it works in a loop.
It assumes that the text is on XY-plane (so, TOP view orientation).
You can select all text, and only the text objects facing BOTTOM are flipped.

FlipText.py (1.8 KB)