MText help: how to set the size

MText help: how to set the size

NickBrege
Enthusiast Enthusiast
2,954 Views
4 Replies
Message 1 of 5

MText help: how to set the size

NickBrege
Enthusiast
Enthusiast

I'm adding MText to paperspace but it gets created too big.  Here is the code I am using:

 

            Dim insertPoint As Double() = {1.0, 1.0, 0}
            Dim noteString As String = "This is my MText."
            doc.PaperSpace.AddMText(insertPoint, 8, noteString)

I can't figure out how to make it smaller.  Is there some font or system variable I need to set first before executing the above code?

If someone could post a small code example or point me in the right direction it would be much appreciated.  Thanks...

0 Likes
Accepted solutions (1)
2,955 Views
4 Replies
Replies (4)
Message 2 of 5

sieclaprzemyslaw
Contributor
Contributor

Hello,

 

 

Simpliest solution I can think of is to change height of the Mtext after adding:

 

Dim insertPoint As Double() = {1.0, 1.0, 0}
Dim noteString As String = "This is my MText."

Dim mT as AcadMText

Set mT=doc.PaperSpace.AddMText(insertPoint, 8, noteString)

'example height of text = 5
mT.height = 5

 

0 Likes
Message 3 of 5

NickBrege
Enthusiast
Enthusiast

Thanks, I will give that a try...

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

Your snippet is not VBA. I think it's VB.NET, so you'd better post your question in the NET forum

 

anyhow, I could throw in the following guessing

 

    Dim insertPoint As Double() = {1.0, 1.0, 0}
    Dim noteString As String = "This is my MText."
    With ThisDrawing.PaperSpace.AddMText(insertPoint, 8, noteString) 'add the MText object and reference it
        .Height = 5 ' set referenced object height
    End With

which is very similar to sieclaprzemyslaw's one, except it doesn't need to declare the MText object

 

0 Likes
Message 5 of 5

NickBrege
Enthusiast
Enthusiast

Thanks for the help guys, that worked.

0 Likes