DimStyleTextAligned seems to not be working

In Python when I run the following code, I get this error: AttributeError: ‘DimensionStyle’ object has no attribute ‘TextAlignment’

import rhinoscriptsyntax as rs

rs.AddDimStyle('test')
rs.DimStyleTextAlignment('test', 1)

I’m I doing something wrong?

I forgot to mention the Rhino version. I’m currently on 8.10.24226.13001. I tested this on the latest SR of Rhino 7 and the problem (if it is one) exists there as well.

@Alain - can you look into this?

For more context, what we’re trying to do is create text and use the “Horizontal to view” option.

image

It doesn’t seem like that option is available for TextObjectText command in RhinoScriptSyntax. We also considered using rs.Command and running the suppressed Text command but the “Horizontal to view” option isn’t available in the command line either :frowning:

image

Hi,
Here’s a sample of how to set the “Horizontal To View” (TextOrientation) property of a TextEntity

from Rhino.Geometry import TextEntity, Plane
from scriptcontext import doc
import rhinoscriptsyntax as rs
from Rhino.DocObjects import TextOrientation

horToView = True
ds = doc.DimStyles.Current
te = TextEntity.Create("hello", Plane.WorldXY, ds, False, 0.0, 0.0)
te.TextOrientation = TextOrientation.InView if horToView else TextOrientation.InPlane
doc.Objects.AddText(te)
rs.Redraw()

Is that what you’re looking for?

1 Like