<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create a annotative mleader in vb.net in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/create-a-annotative-mleader-in-vb-net/m-p/10472218#M6459</link>
    <description>&lt;P&gt;See &lt;A href="https://forums.autodesk.com/t5/net/annotative-mleader-problem/m-p/4808483#M39148" target="_blank" rel="noopener"&gt;THIS&lt;/A&gt; response to a similar question.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 19:34:01 GMT</pubDate>
    <dc:creator>Jeff_M</dc:creator>
    <dc:date>2021-07-15T19:34:01Z</dc:date>
    <item>
      <title>Create a annotative mleader in vb.net</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/create-a-annotative-mleader-in-vb-net/m-p/10469685#M6458</link>
      <description>&lt;P&gt;I am trying to create a multileader vb.net. I am mostly successful except for two issues.&lt;/P&gt;&lt;P&gt;One, the text for the multileader is white instead of by layer. the color does change if I double click on the mtext to edit it.&lt;/P&gt;&lt;P&gt;Two the text does not add annotation scales. The arrow itself scales but not the text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Sub DrawLeader(ldrText As String, ldrRoatateRaw As Double, invLayer As String)
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        Dim edt As Editor = doc.Editor
 
        Dim mlIns As Point3d = edt.GetPoint(vbCrLf + "Select the Mleader insertion point: ").Value
        Dim mlTIns As Point3d = edt.GetPoint(vbCrLf + "Select text insertion location: ").Value
 
        Using trans As Transaction = db.TransactionManager.StartTransaction()
            doc.LockDocument()
            Try
                Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead)
                Dim btr As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
                Dim dict As DBDictionary = db.MLeaderStyleDictionaryId.GetObject(OpenMode.ForRead)
                Dim mlstyle As ObjectId = dict.GetAt("BA_EX_L90_Arrow")
                Application.SetSystemVariable("TEXTSTYLE", "BA_EX_L90")
                Dim mlText As New MText With
                    {.Contents = ldrText,
                    .Rotation = ldrRoatateRaw,
                    .TextStyleId = db.Textstyle
                    }
                Using mldr As New MLeader
                    mldr.MLeaderStyle = mlstyle
                    Dim index As Integer = mldr.AddLeaderLine(New Point3d(0, 0, 0))
                    mldr.AddFirstVertex(index, mlIns)
                    mldr.Layer = invLayer
                    mldr.ContentType = ContentType.MTextContent
                    mldr.MText = mlText
                    mldr.TextLocation = mlTIns
                    mldr.Annotative = AnnotativeStates.True
                    btr.AppendEntity(mldr)
                    trans.AddNewlyCreatedDBObject(mldr, True)
                End Using
                trans.Commit()
                doc.SendStringToExecute("regen", True, False, False)
            Catch ex As Exception
                edt.WriteMessage(vbCrLf + "Error encountered: " + ex.Message)
                trans.Abort()
            End Try
        End Using
    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The leader style is &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gosbee30_0-1626311316212.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/941516iB1001AF10A1C5383/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gosbee30_0-1626311316212.png" alt="gosbee30_0-1626311316212.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gosbee30_1-1626311316175.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/941518i8DD43C0742ABB927/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gosbee30_1-1626311316175.png" alt="gosbee30_1-1626311316175.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gosbee30_2-1626311316253.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/941519i754BA13506530E19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gosbee30_2-1626311316253.png" alt="gosbee30_2-1626311316253.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And my Text Style is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gosbee30_3-1626311316220.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/941520iD901AF61ED7E249E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gosbee30_3-1626311316220.png" alt="gosbee30_3-1626311316220.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 01:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/create-a-annotative-mleader-in-vb-net/m-p/10469685#M6458</guid>
      <dc:creator>gosbee30</dc:creator>
      <dc:date>2021-07-15T01:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a annotative mleader in vb.net</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/create-a-annotative-mleader-in-vb-net/m-p/10472218#M6459</link>
      <description>&lt;P&gt;See &lt;A href="https://forums.autodesk.com/t5/net/annotative-mleader-problem/m-p/4808483#M39148" target="_blank" rel="noopener"&gt;THIS&lt;/A&gt; response to a similar question.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 19:34:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/create-a-annotative-mleader-in-vb-net/m-p/10472218#M6459</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2021-07-15T19:34:01Z</dc:date>
    </item>
  </channel>
</rss>

