Mtext in dimension

Mtext in dimension

Anonymous
Not applicable
385 Views
5 Replies
Message 1 of 6

Mtext in dimension

Anonymous
Not applicable
When placing an aligned dimension manually there is an option to place the
text as mtext, so it will word wrap inside the extension lines. There
appears no way of achieving this with the VBA methods unless somebody knows
different?

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
0 Likes
386 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Since there is an AddText and AddMText method, I would think not, but maybe
I'm wrong.

"Dave Preston" wrote in message
news:5200985@discussion.autodesk.com...
When placing an aligned dimension manually there is an option to place the
text as mtext, so it will word wrap inside the extension lines. There
appears no way of achieving this with the VBA methods unless somebody knows
different?

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
0 Likes
Message 3 of 6

Anonymous
Not applicable
They are specifically for text / mtext, not within a dimension, but thanks
for replying. I was hoping for an option with the AddDimAligned method

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
"Joe Sutphin" wrote in message
news:5201062@discussion.autodesk.com...
Since there is an AddText and AddMText method, I would think not, but maybe
I'm wrong.

"Dave Preston" wrote in message
news:5200985@discussion.autodesk.com...
When placing an aligned dimension manually there is an option to place the
text as mtext, so it will word wrap inside the extension lines. There
appears no way of achieving this with the VBA methods unless somebody knows
different?

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
0 Likes
Message 4 of 6

Anonymous
Not applicable
I don't know why, but I totally missed that in your post, sorry.

"Dave Preston" wrote in message
news:5201308@discussion.autodesk.com...
They are specifically for text / mtext, not within a dimension, but thanks
for replying. I was hoping for an option with the AddDimAligned method

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
"Joe Sutphin" wrote in message
news:5201062@discussion.autodesk.com...
Since there is an AddText and AddMText method, I would think not, but maybe
I'm wrong.

"Dave Preston" wrote in message
news:5200985@discussion.autodesk.com...
When placing an aligned dimension manually there is an option to place the
text as mtext, so it will word wrap inside the extension lines. There
appears no way of achieving this with the VBA methods unless somebody knows
different?

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
0 Likes
Message 5 of 6

Anonymous
Not applicable
All the Mtext/Text options are is to select which method you want to enter your text override string in. Either using the Mtext
editor dialog or to just type the text in as a string. So you'll need some method of checking the width of your input text override
to see that it doesn't exceed the measured dimension.

Here's a method I use that splits text up so as not to exceed a selected width. Maybe it can be modifed to work for fitting your
textoverride into your aligned dimension:

SplitTxt = ""
txtWords = Split(txt, " ")
txtLine = ""
' Copy the original text object, so that the
' routine can utilize its .GetBoundingBox function
Set tmpText = TextObj.Copy
For i = LBound(txtWords) To UBound(txtWords)
tmpText.TextString = Trim(txtLine & " " & txtWords(i))
tmpText.GetBoundingBox Min, Max
ActDist = Max(0) - Min(0)
If ActDist > MaxDist Then
SplitTxt = SplitTxt & txtLine & vbCrLf
txtLine = ""
End If
txtLine = Trim(txtLine & " " & txtWords(i))
Next
txtNotes.Text = SplitTxt & txtLine

See VBA Help for setting the override:

Sub Example_TextOverride()
' This example creates an aligned dimension and then changes the
' TextOverride property for that dimension.

Dim dimObj As AcadDimAligned
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
Dim location(0 To 2) As Double

' Define the dimension
point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
location(0) = 7.5: location(1) = 5#: location(2) = 0#

' Create an aligned dimension object in model space
Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
ZoomAll
MsgBox "The initial text string for the dimension contains only the dimension value.", vbInformation, "TextOverride Example"

' Change the text string for the dimension
dimObj.TextOverride = "The value is <>"
dimObj.Update
MsgBox "The text string for the dimension has been replaced. However, the dimension value is still represented.", vbInformation,
"TextOverride Example"

' Reset the text string for the dimension
dimObj.TextOverride = ""
dimObj.Update

MsgBox "The text string for the dimension is reset.", vbInformation, "TextOverride Example"
End Sub
0 Likes
Message 6 of 6

Anonymous
Not applicable
Thanks Allen. I had resorted to doing the same

--
Dave Preston
Technical Dev. Engineer
C A Design Services Limited
Address: Design Centre, Hewett Rd, Gapton Hall,
GREAT YARMOUTH,
Norfolk 31 0NN,
Tel: 01493 440444,
Fax: 01493 442480,

E-Mail: dpreston@cadesignservices.co.uk,
Web Site: www.cadesignservices.co.uk,

Registered in England No. 1595687

This e-mail and any attached files is confidential and intended for the
addressee(s) only. It may contain privileged and confidential information,
and may not be disclosed to anyone else. Unauthorised recipients are
requested to preserve this confidentiality by deleting the original and to
advise the sender immediately of any mistakes in transmission. Internet
communications are not secure and therefore C A Design Services Limited does
not accept any legal responsibility for the contents of this message, and
the message and files are opened at the risk of the recipient. Unless
otherwise specifically stated any views or opinions are solely those of the
author and do not represent those of C A De
"Allen Johnson" wrote in message
news:5201442@discussion.autodesk.com...
All the Mtext/Text options are is to select which method you want to enter
your text override string in. Either using the Mtext
editor dialog or to just type the text in as a string. So you'll need some
method of checking the width of your input text override
to see that it doesn't exceed the measured dimension.

Here's a method I use that splits text up so as not to exceed a selected
width. Maybe it can be modifed to work for fitting your
textoverride into your aligned dimension:

SplitTxt = ""
txtWords = Split(txt, " ")
txtLine = ""
' Copy the original text object, so that the
' routine can utilize its .GetBoundingBox function
Set tmpText = TextObj.Copy
For i = LBound(txtWords) To UBound(txtWords)
tmpText.TextString = Trim(txtLine & " " & txtWords(i))
tmpText.GetBoundingBox Min, Max
ActDist = Max(0) - Min(0)
If ActDist > MaxDist Then
SplitTxt = SplitTxt & txtLine & vbCrLf
txtLine = ""
End If
txtLine = Trim(txtLine & " " & txtWords(i))
Next
txtNotes.Text = SplitTxt & txtLine

See VBA Help for setting the override:

Sub Example_TextOverride()
' This example creates an aligned dimension and then changes the
' TextOverride property for that dimension.

Dim dimObj As AcadDimAligned
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
Dim location(0 To 2) As Double

' Define the dimension
point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
location(0) = 7.5: location(1) = 5#: location(2) = 0#

' Create an aligned dimension object in model space
Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2,
location)
ZoomAll
MsgBox "The initial text string for the dimension contains only the
dimension value.", vbInformation, "TextOverride Example"

' Change the text string for the dimension
dimObj.TextOverride = "The value is <>"
dimObj.Update
MsgBox "The text string for the dimension has been replaced. However,
the dimension value is still represented.", vbInformation,
"TextOverride Example"

' Reset the text string for the dimension
dimObj.TextOverride = ""
dimObj.Update

MsgBox "The text string for the dimension is reset.", vbInformation,
"TextOverride Example"
End Sub
0 Likes