Disable automatic text orientation

Rhino 6SR15 / RhinoCommon

Hi!
I’m trying to rotate a TextBlock by a variable angle.
I noticed that, if rotation angle is greater than 90°, Rhino “adds” an extra rotation by 180°.
I guess this is a standard behaviour to ensure text is “as horizontal as possible” but I need to disable this feature.
Is it possible?
Thanks. :slight_smile:

@Alain, can you help with this?

– Dale

Hi,
Does setting the TextOrientation property of TextEntity to Rhino.DocObjects.TextOrientation.InPlane do what you want?

Sorry… No!
It makes no difference at all.
Just to give you some more information, that’s what i’m doing.

  • Read the contents of a 3DM file
  • Cycle through all the objects in the file
  • If an object geometry is of TextEntity type, i change its TextOrientation property as you suggested
  • Rotate all the objects read
  • Add the objects to the document

Thanks, anyway… :slight_smile:

Would you mind sharing the script/code?

Here’s some (incomplete) sample code

// 3DM file loading
this.LoadedFile3DM = File3dm.Read(selectStampDlg.FileName);

...

// Rhino forum change
foreach (File3dmObject fileObj in this.LoadedFile3DM.Objects)
{
  if (!(fileObj.Geometry is TextEntity))
    continue;
  TextEntity fileTextEntity = fileObj.Geometry as TextEntity;
  fileTextEntity.TextOrientation = TextOrientation.InPlane;
}

...

// Import of dimension styles from 3DM file - Quite long... Skipped

...

// Calc o transformation matrix
Transform objectsTrans = Transform.Identity;
objectsTrans *= Transform.Translation(translation);
objectsTrans *= Transform.Rotation(rotationAngleRad, stampOriginalCenter);

...

// File objects transformation / Objects adding to document
foreach (File3dmObject fileObj in this.LoadedFile3DM.Objects)
{
  GeometryBase fileObjDuplicate = fileObj.Geometry.Duplicate();
  fileObjDuplicate.Transform(objectsTrans);
  if (fileObjDuplicate is TextEntity)
    (fileObjDuplicate as TextEntity).Transform(Transform.Identity, RhinoDoc.ActiveDoc.DimStyles.FindName(styleName));

  RhinoDoc.ActiveDoc.Objects.Add(fileObjDuplicate);
}

Do you see something strange?

It looks like you’re changing the TextOrientation but then re-read the object from the model. What if you change the property in the 2nd loop instead, after calling Duplicate()?

I’m doing something different, actually: the model is read just once… Anyway i tried to do as you suggested but it makes no difference… :-/
I found that everything works if i turn off an option in the annotation style window… Sorry: interface in italian!


How can i set this option at run time?

@software_comas,
The DimensionStyle property name is DrawForward. Even though the UI doesn’t let you change it for each annotation you can do it through code since that property also exists on AnnotationBase.

Thanks, Alain!

Hi,
I have tried to compile an python component to my grasshopper based on this message, but cannot get my head around it. I am quite new to using python overall and specially in grasshopper. Could someone explain how to construct a python code (or just maybe write it so no further questions wouldn’t rise) that would disable the automatic text orientation in Rhino?

The input for the python component would be in the form of GUID and not a text object.

If I had text objects I wouldn’t be in this trouble - I have found many ways to encounter this problem if I had text objects (for example Human and Horster plugins and individual pieces of python scripts).

I got my file working just fine when I found the option from the Rhino’s Properties window based on picture posted by Sebastiano previously in this conversation, so I know that is the thing I need.