DimStyleTextAlignment not up to date?

Hi,
dimension.py is refering to old API I guess.
I still have to work (efficently) with rhino 5 since my scripts cant work for the moment.
Is there a plan to review rhinopython soon ?

(Is “Serengeti” for WIP or Rhino 6 ?)

code from dimension.py

def DimStyleTextAlignment(dimstyle, alignment=None):
"""..."""
    ds = scriptcontext.doc.DimStyles.FindName(dimstyle)
    if ds is None: return scriptcontext.errorhandler()
    rc = int(ds.TextAlignment) <=================== HERE (seems to be TextDisplayAlignment now ?)
    if alignment is not None:
        if alignment==0: ds.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.Normal
        if alignment==1: ds.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.Horizontal
        if alignment==2: ds.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.AboveLine
        if alignment==3: ds.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.InLine
        scriptcontext.doc.DimStyles.Modify(ds, ds.Id, False)
        scriptcontext.doc.Views.Redraw()
    return rc

Hi,
We’re in the process of fixing these. Dimensions have changed considerably so we’re doing our best not to introduce breaking changes.

1 Like

Hi @Alain, any news ? I am running into this and rs.DimStyleTextAlignment throws an error in Rhino 6. Can you tell how to set it for all dimension types in RH6 ? In Rhino 5 this worked:

style.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.InLine
style.CommitChanges()

Edit: I’ve found your answer here:

dim_style.DimTextLocation = Rhino.DocObjects.DimensionStyle.TextLocation.InDimLine
scriptcontext.doc.DimStyles.Modify(dim_style, dim_style.Id, True)

thanks,
c.