Hi,
I am facing trouble to assign a annotationstyle to a text.
Here’s what I tried:
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
text = rs.AddText("TEST", rs.WorldXYPlane())
ref = Rhino.DocObjects.ObjRef(text)
ref.Object().TextGeometry.DimensionStyleId = parent_style.Id
ref.Object().CommitChanges()
sc.doc.Views.ActiveView.Redraw()
What am I missing?
I guess it’s about what to access in the ObjectReference, right?
Thanks,
T.
dale
(Dale Fugier)
2
@Alain - can you help with this?
djordje
3
Hi Tobias,
Try this:
import rhinoscriptsyntax as rs
import Rhino
styleName = "Millimeter Architectural"
txt_id = rs.AddText("TEST", rs.WorldXYPlane())
txtE = rs.coercegeometry(txt_id)
dimStyle = Rhino.RhinoDoc.ActiveDoc.DimStyles.FindName(styleName)
if dimStyle is None:
print "no '{}' annotation style exists in the current rhino file".format(dimStyle)
else:
txtE.DimensionStyleId = dimStyle.Id
txt_id = Rhino.RhinoDoc.ActiveDoc.Objects.Replace(txt_id, txtE)
rs.Redraw()
1 Like
@djordje , pefect.
Thanks!
1 Like