Set Model Space Scale on Text objects

I would like to write a Rhino Python script that sets the Model Space Scale on selected Text objects to = 1.

(because when I export Text objects to DXF for our plotting machine, the height of the Text exported = Text.Height x Text.Model Space Scale).

I can’t seem to find the right command for this, so I have to select the objects in Rhino itself and manually change the attribute value.

Thanks in advance!

Hi @dgs, below seems to do it, tested in Rhino 7 & 8:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():

    text_id = rs.GetObject("Select text", rs.filter.annotation, True, False)
    if not text_id: return
    
    text_obj = rs.coercerhinoobject(text_id, True, True)
    if not isinstance(text_obj, Rhino.DocObjects.TextObject): return
    
    text_obj.TextGeometry.DimensionScale = 1.0
    text_obj.CommitChanges()
    scriptcontext.doc.Views.Redraw()

DoSomething()

_
c.

That did the trick, thank you @clement !