Bug: rs.AddText() is missing option to set "Style"


#1

In I script where I use rs.AddText() I get the wrong height since I can not set “Default” as Dimension style.
It defaults to use “Millimeter Small” which is a 1:10 scale so an option for this is needed asap please.

-J


#2

Dunno, the following seems to work to add a 10mm text even if I have “Millimeter Small” as the selected annotation style i.e. seems to ignore the style default values. What am I missing?

import rhinoscriptsyntax as rs
origin=rs.coerce3dpoint([0,0,0])
rs.AddText("Test",origin,10.0,"Arial",0,1+65536)

#3

Hi Mitch, it adds a text all right, but the height is not “10” units, it’s 10 units according to Millimeter Small.
To check if I am right you can set style to “Default” or “millimeter large” and run the script again and it should output a different size.

Maybe my expectations of a text object with no style and just a size is wrong. And if so it would be good to be able to define the dim style when creating the object, unless it makes more sense to do so after it is made?


#4

Ah, yes, I didn’t actually measure the text height… It’s 100mm if MillimeterSmall is active… :frowning:

I agree, this is positively painful. I looked into trying to create a default annotation style with a scale of 1, but I didn’t figure it out yet - I don’t see a setting for creating a style with a particular scale (1).

So, yeah, I agree this needs to be fixed. I really wonder how much the introduction of this whole RTF styles stuff solves problems vs. creates them…

–Mitch


#5

Here is a hack - problem is it will create a dimstyle and add it to the document. I don’t see any other way, because you can never be sure that there will actually be a dimstyle in the document that has a 1:1 scale - as you can modify them all, there is no official “default” style. And any text HAS to have a dimstyle associated with it now as far as I can tell…

import rhinoscriptsyntax as rs
import scriptcontext as sc

rs.AddDimStyle("no_scale_ref_style")
ref_style=sc.doc.DimStyles.Find("no_scale_ref_style",True)
ref_style.DimensionScale=1.0
rs.CurrentDimStyle("no_scale_ref_style")
origin=rs.coerce3dpoint([0,0,0])
rs.AddText("Test",origin,10.0,"Arial",0,1+65536)

(Alain Cormier) #7

Hi. I logged this issue.

The issue it depends on is being discussed here.