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
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
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)
Thank you for your effort! Is there a way to make this work for the text that has been mirrored in the top view? My problem is not that the text is facing down but that I have mirrored before so the arrow is pointing in other direction.
Hi @honza
could you provide a file or at least a picture?
mirrored leaders.3dm (865.1 KB)
here it is - mirrored leaders and dimensions - unticked âtext reads forward whenâŚâ
Hi @honza
as these were leaders and dimensions, I took a different approach.
Here is a Gh script that recreates the leaders and dimensions to the (hopefully)correct orientation. The leaders were easy to recreate, but for the dimensions I had to do it in python, because the Linear dimension component does not seem to return the correct points for recreating the dimension. @AndyPayne
Recreate leaders.gh (21.3 KB)
Original:
Recreation:
@Toni_Osterlund Can you post the Rhino file too so I can test against the same leaders/dimensions youâre working with?
@AndyPayne It was this file, posted by @honza
IMO the component should return the green pts, but currently it seemed to return the red ones.
So, if I would want to re-create the dimension using the points and offset, the new dimensionâs position does not match anymore - offsetting it by the offset amount.
Thanks for reporting this @Toni_Osterlund. This has been fixed and should be available in the next service release (Rhino 8.9).
Thank you so much! This saved me a lot of time