Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MText Justification not showing up.

91 views
Skip to first unread message

Jeff Rusk

unread,
Feb 9, 1999, 3:00:00 AM2/9/99
to
Hi, I was wondering if anyone else has had a problem setting
justifications for MText objects and then not applying the justification to
the drawing. When listing the object, the justification is correct, but it
has not been applied. I can go to Modify->Object->Text and then just hit
OK (without changing anything) and then the justification is applied. Is
there something I am forgetting to do. I use the Update method on the text
but to no avail. Basically everything is fine other than the fact that the
justification is not being applied
Here is the relevant snippet of code:

<-----code starts------>
Set newMtext = ThisDrawing.ModelSpace.AddMText(InsertionPoint, Mwidth,
textString)


newMtext.Layer = Layer
newMtext.Rotation = mef_angle
newMtext.StyleName = NewMefFont

Select Case txtJust
Case 1: newMtext.AttachmentPoint = acAttachmentPointBottomLeft
Case 2: newMtext.AttachmentPoint = acAttachmentPointBottomCenter
Case 3: newMtext.AttachmentPoint = acAttachmentPointBottomRight
Case 4: newMtext.AttachmentPoint = acAttachmentPointMiddleLeft
Case 5: newMtext.AttachmentPoint = acAttachmentPointMiddleCenter
Case 6: newMtext.AttachmentPoint = acAttachmentPointMiddleRight
Case 7: newMtext.AttachmentPoint = acAttachmentPointTopLeft
Case 8: newMtext.AttachmentPoint = acAttachmentPointTopCenter
Case 9: newMtext.AttachmentPoint = acAttachmentPointTopRight
End Select
newMText.Update
<-----code ends---->


If anyone has any experience with this issue, I would most appreciate it.
Thanks in advance.

-----------------------------------------------------------------------
Jeff Rusk, Technologist
Software Development Staff
J.D. Barnes Ltd.
Markham, ON, CANADA
rj...@jdbarnes.com
--- Surveying, Mapping, and Land Information Services ---

U.V.L. Narayana

unread,
Feb 11, 1999, 3:00:00 AM2/11/99
to
Hello Jeff,

This code (+necessary code) seems to run OK for us.
Could this be an installation issue or problem in surrounding code?
Also you have the numeric values
incorrect for the Constants (if that's what you are trying to work with)
in the Select statement.

You might want to run the code from our Online Help file MText Object ->
AttachmentPoint Property -> AttachmentPoint Example and see if it works. It should.
If you contine to have problems, let us know.

Thanks
-U.V.L. Narayana
Autodesk, Inc.


Our working code:

Sub UserMtext()
Dim newMtext As AcadMtext
Dim Mwidth As Double
Dim TextString As String
Dim txtJust As Integer
Dim InsertionPoint(0 To 2) As Double
Dim attachPoint As String
Dim center(0 To 2) As Double
Dim circleObj As AcadCircle

Mwidth = 3.25
TextString = "User MText String"
InsertionPoint(0) = 2#: InsertionPoint(1) = 2.5: InsertionPoint(2) = 0#
Set newMtext = ThisDrawing.ModelSpace.AddMText(InsertionPoint, Mwidth, TextString)
newMtext.Update
' newMtext.Layer = Layer


' newMtext.Rotation = mef_angle
' newMtext.StyleName = NewMefFont

center(0) = InsertionPoint(0)
center(1) = InsertionPoint(1)
center(2) = InsertionPoint(2)
Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, 0.025)
circleObj.Color = acRed
circleObj.Update

For txtJust = 1 To 9

Select Case txtJust
' acAttachmentPointBottomLeft = 7


Case 1: newMtext.AttachmentPoint = acAttachmentPointBottomLeft

' MsgBox "acAttachmentPointBottomLeft"
' acAttachmentPointBottomCenter = 8


Case 2: newMtext.AttachmentPoint = acAttachmentPointBottomCenter

' MsgBox "cAttachmentPointBottomCenter"
' acAttachmentPointBottomRight = 9


Case 3: newMtext.AttachmentPoint = acAttachmentPointBottomRight

' MsgBox "acAttachmentPointBottomRight"
' acAttachmentPointMiddleLeft = 4


Case 4: newMtext.AttachmentPoint = acAttachmentPointMiddleLeft

' MsgBox "acAttachmentPointMiddleLeft"
' acAttachmentPointMiddleCenter = 5


Case 5: newMtext.AttachmentPoint = acAttachmentPointMiddleCenter

' MsgBox "acAttachmentPointMiddleCenter"
' acAttachmentPointMiddleRight = 6


Case 6: newMtext.AttachmentPoint = acAttachmentPointMiddleRight

' MsgBox "acAttachmentPointMiddleRight"
' acAttachmentPointTopLeft = 1


Case 7: newMtext.AttachmentPoint = acAttachmentPointTopLeft

' MsgBox "acAttachmentPointTopLeft"
' acAttachmentPointTopCenter = 2


Case 8: newMtext.AttachmentPoint = acAttachmentPointTopCenter

' MsgBox "acAttachmentPointTopCenter"
' acAttachmentPointTopRight = 3


Case 9: newMtext.AttachmentPoint = acAttachmentPointTopRight

' MsgBox "acAttachmentPointTopRight"
End Select
newMtext.Update

Next
End Sub

0 new messages