Add text with modelspacescale = 1

I need to add text to a drawing that may have a modelspacescale different from 1, but the text needs to drawn at the specified height, ie modelspacescale = 1.

I can’t alter the modelspacescale document wide as other parties may be adding text as well.

I can’t see a setting on the text entity for this.

I have tried temporarily changing the modelspacescale to 1 whilst I add the text, like below, but it doesn’t work.

Any idea how i can do this?

                   tsc = doc.ModelSpaceTextScale
                    doc.ModelSpaceTextScale = 1
                    guid  = doc.Objects.AddText(txtent, atts)
                    doc.ModelSpaceTextScale = tsc

Hi User149,
Let’s talk about Rhino. It will hopefully help your Python scripting.

Rhino 4 & 5 used a global model space scale.
Rhino 6 and later use a Model Scale that is set in the Annotation style.

For a puedo-global Model scale effect, you will need to set all the dimensions to the same Annotation style, and change the Model scale in the Style.

If you want to see text scaled using the model scale on a layout detail, you will need to disable the Layout scaling here:

Let us know if you have any additional questions.
Sincerely,
Mary Ann Fugier

Mary Ann Fugier

Thank you for your reply.

Just to clarify, we are not using Python scripting, and we are aware of the introduction of Model space scaling in Rhino 6 and Rhino 7, and we are not adding dimensions, just plain text.

What we need to know is how to add a text entity, using vb net and Rhino commons, that has the model space scaling set to 1 for that entity, without altering the document wide model space scaling.

I hope you can help us with that.

Andrew

bump

Hi @user149,

Like @mary said, the global model space scale, found in Rhino 5, was abandoned. In Rhino 6 and newer, each annotation style has it’s own model space scale. Note, all annotations (e.g. dimensions, leaders, text, etc.) use annotation styles.

If you want to create text and has a custom model space scale, then you can do so like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  // Get the current annotation) style
  var dimStyle = doc.DimStyles.Current;
  if (null == dimStyle)
    return Result.Failure;

  // Create a text entity that uses the annotation style
  var textEntity = TextEntity.Create("Hello Rhino!", Plane.WorldXY, dimStyle, false, 0, 0);
  if (null == textEntity)
    return Result.Failure;

  // Override the text height
  textEntity.TextHeight = 1.0;

  // Override the model space scale
  textEntity.DimensionScale = 10.0;

  // Add to the document
  doc.Objects.AddText(textEntity);
  doc.Views.Redraw();

  return Result.Success;
}

Hope this helps.

– Dale

Thanks, that worked. It was the use of “dimensionscale” to change the text entity model space scale that I had missed.

For reference, here is the code that we ended up using:

          Dim t As New TextEntity

                t.PlainText = txt
                t.Font = New Font(fontname)
                t.Plane = myplane
                t.TextHeight = ht
                t.DimensionScale = 1

              doc.Objects.AddText(t, atts)  
                                 ' where atts is the document default attributes