Cannot align text to be inline with dimension line

The simple Python script below fails to create a dimension line if the line:

rs.DimStyleTextAlignment(rec_dims, 3)

is included. The error message is:

‘DimensionStyle’ object has no attribute ‘TextAlignment’

Without this line it works fine but the text is above the dimension line rather than inline as I wanted. What happened to the the DimStyleTextAlignment attribute? I am using the latest version of Rhino6. This also fails in the same way if I try using rhinocommon calls. I think I must have missed the memo about this.

import  rhinoscriptsyntax as rs
x0 = 182.9; x1 = 247.7
y0 = 592.
Xz0 = 0.0
rec_dims = rs.AddDimStyle('rec_dims')
rs.DimStyleArrowSize(rec_dims, 2.0)
rs.DimStyleExtension(rec_dims, 1.5)
rs.DimStyleTextHeight(rec_dims, 1.5)
rs.DimStyleTextAlignment(rec_dims, 3)

begin = x0, y0, Xz0
end = x1, y0, Xz0
point = x0, y0-2, Xz0
dl = rs.AddAlignedDimension(begin, end, point, rec_dims)



Do you have any idea how I can get rs.DimStyleTextAlignment working? It seems to be broken for me in the latest version of Rhino6.


@Alain, is this something you can look into?

@dale, @Alain, @Helvetosaur,

Any idea how I can get rs.DimStyleTextAlignment
to work?


Still looking for a solution to this. Please help.

Hi Terry,

Dimension alignment has changed considerably in Rhino 6. Until rhinoscriptsyntax is revised you can align the text in the dimension line by replacing rs.DimStyleTextAlignment with:

import Rhino
ds.DimTextLocation = Rhino.DocObjects.DimensionStyle.TextLocation.InDimLine
doc.DimStyles.Modify(ds, ds.Id, False)
1 Like