Bake TextEntity problem

hi all,

if a DimensionStyle is used to create a TextEntity the DimensionStyle is not taken into account if the TextEntity get baked.
How can i force

Rhino.RhinoDoc.ActiveDoc.Objects.AddText(TextEntity)

to use the changes in DimensionStyle.

import Rhino as rh
import scriptcontext as sc

# get dimstyle 
ds = rh.DocObjects.DimensionStyle()


# change text properties in dimstyle
ds.Font = rh.DocObjects.Font('Arimo')
ds.TextHeight = 4
ds.TextVerticalAlignment = rh.DocObjects.TextVerticalAlignment.Bottom


# create textentity 
te = rh.Geometry.TextEntity.Create(T,P,ds,False,0,0)


# bake textentity to get rhinotext object
if Bake:
    sc.doc = rh.RhinoDoc.ActiveDoc
    rh.RhinoDoc.ActiveDoc.Objects.AddText(te)
    sc.doc = ghdoc

In this post How to preview Text3d in Rhino i dont use TextEntity object to AddText instead the whole settings used for TextEntity DimensionStyle is setup again to get a baked text with changes.

If i use TextEntitySurface the dimestyle is taken into account.

I am confused and help is appreciated.

Hi,
You probably need to add the new annotation style to the Rhino document:

# get dimstyle 
d = rh.RhinoDoc.ActiveDoc
idx = d.DimStyles.Add('', False)
ds = d.DimStyles[idx]

# change text properties in dimstyle
ds.Font = rh.DocObjects.Font('Arimo')
ds.TextHeight = 4
ds.TextVerticalAlignment = rh.DocObjects.TextVerticalAlignment.Bottom
d.DimStyles.Modify(ds, ds.Id, False)
1 Like