Place mText with annotative scale via VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
How to enable annotative scale when placing leader with Mtext via VBA ?
Thank you!
Sub AddLeader(ptcenter As Variant, txtpoint As Variant, Noofdigit As Integer) 'place coordinate with leader
Dim points(0 To 5) As Double
Dim xText As String
Dim yText As String
Dim txtCoord As String
Dim leaderObj As AcadLeader
Dim MtextObj As AcadMText
xText = digit(ptcenter(0), Noofdigit)
yText = digit(ptcenter(1), Noofdigit)
txtCoord = xText & " E" & vbCrLf & yText & " N"
points(0) = ptcenter(0): points(1) = ptcenter(1): points(2) = ptcenter(2)
points(3) = txtpoint(0): points(4) = txtpoint(1): points(5) = txtpoint(2)
Set MtextObj = ThisDrawing.ModelSpace.AddMText(txtpoint, Len(txtCoord) * ThisDrawing.GetVariable("dimscale"), txtCoord)
Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, MtextObj, acLineWithArrow)
leaderObj.TextGap = 0
If ptcenter(0) < txtpoint(0) Then
MtextObj.AttachmentPoint = acAttachmentPointMiddleLeft
Else
MtextObj.AttachmentPoint = acAttachmentPointMiddleRight
End If
MtextObj.InsertionPoint = txtpoint
MtextObj.Rotation = 0
leaderObj.Update
End Sub