<?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 MText Associativity Exception in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371161#M56848</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I am new to developing with this API but not to VB.NET.&amp;nbsp; I am trying to associate mtext to a leader using the instructions in the AutoCAD .NET Developer's Guide (115) for AutoCAD 2012 but keep getting the &lt;FONT color="#ff0000"&gt;eInvalidInput&lt;/FONT&gt; exception.&amp;nbsp; One suggestion is that an exception is thrown if the mtext does not exist but I checked the mtext objectid for null and valid which returns good.&amp;nbsp; I am certain that I am missing something but not sure what.&amp;nbsp; I have included&amp;nbsp;my source; the exception occurs at: &lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.EvaluateLeader()&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks in Advance -Ken&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Dim &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acDoc &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Document = Application.DocumentManager.MdiActiveDocument&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acCurDb &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Database = acDoc.Database&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt; acTrans &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Transaction = acCurDb.TransactionManager.StartTransaction()&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acBlkTbl &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockTable&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acBlkTblRec &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockTableRecord&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Create the MText annotation&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acMText &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; MText = &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;New&lt;/FONT&gt;&lt;/FONT&gt; MText()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.SetDatabaseDefaults()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Layer =&lt;/FONT&gt;&lt;FONT color="#a31515" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#a31515"&gt;"TEXT"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Contents = contents&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="arial,helvetica,sans-serif"&gt;'pt is a function that returns a Point3d(x, y, z) where z = 0﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Location = pt(endPt.X + 2, endPt.Y + acMText.ActualHeight / 2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Width = 70&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Add the new object to Model space and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec.AppendEntity(acMText)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.AddNewlyCreatedDBObject(acMText, &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Create the leader&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acLdr &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Leader = &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;New&lt;/FONT&gt;&lt;/FONT&gt; Leader()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.SetDatabaseDefaults()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.Layer = &lt;/FONT&gt;&lt;FONT color="#a31515" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#a31515"&gt;"DIM"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(startPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(breakPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(endPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.HasArrowHead = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Add the new object to Model space and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec.AppendEntity(acLdr)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.AddNewlyCreatedDBObject(acLdr,&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Attach the annotation after the leader object is added&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.Annotation = acMText.Object&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.EvaluateLeader()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.Commit()&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Mar 2012 18:35:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-03-14T18:35:53Z</dc:date>
    <item>
      <title>MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371161#M56848</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I am new to developing with this API but not to VB.NET.&amp;nbsp; I am trying to associate mtext to a leader using the instructions in the AutoCAD .NET Developer's Guide (115) for AutoCAD 2012 but keep getting the &lt;FONT color="#ff0000"&gt;eInvalidInput&lt;/FONT&gt; exception.&amp;nbsp; One suggestion is that an exception is thrown if the mtext does not exist but I checked the mtext objectid for null and valid which returns good.&amp;nbsp; I am certain that I am missing something but not sure what.&amp;nbsp; I have included&amp;nbsp;my source; the exception occurs at: &lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.EvaluateLeader()&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks in Advance -Ken&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Dim &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acDoc &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Document = Application.DocumentManager.MdiActiveDocument&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acCurDb &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Database = acDoc.Database&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt; acTrans &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Transaction = acCurDb.TransactionManager.StartTransaction()&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acBlkTbl &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockTable&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acBlkTblRec &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockTableRecord&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Create the MText annotation&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acMText &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; MText = &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;New&lt;/FONT&gt;&lt;/FONT&gt; MText()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.SetDatabaseDefaults()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Layer =&lt;/FONT&gt;&lt;FONT color="#a31515" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#a31515"&gt;"TEXT"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Contents = contents&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000" face="arial,helvetica,sans-serif"&gt;'pt is a function that returns a Point3d(x, y, z) where z = 0﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Location = pt(endPt.X + 2, endPt.Y + acMText.ActualHeight / 2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acMText.Width = 70&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Add the new object to Model space and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec.AppendEntity(acMText)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.AddNewlyCreatedDBObject(acMText, &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Create the leader&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; acLdr &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Leader = &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;New&lt;/FONT&gt;&lt;/FONT&gt; Leader()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.SetDatabaseDefaults()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.Layer = &lt;/FONT&gt;&lt;FONT color="#a31515" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#a31515"&gt;"DIM"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(startPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(breakPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.AppendVertex(endPt)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.HasArrowHead = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Add the new object to Model space and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acBlkTblRec.AppendEntity(acLdr)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.AddNewlyCreatedDBObject(acLdr,&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;)&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#008000"&gt;'Attach the annotation after the leader object is added&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.Annotation = acMText.Object&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acLdr.EvaluateLeader()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;acTrans.Commit()&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2012 18:35:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371161#M56848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-14T18:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371343#M56849</link>
      <description>&lt;P&gt;Ken&lt;/P&gt;&lt;P&gt;I can't test it on a2012 but can you try as-is the next&lt;/P&gt;&lt;P&gt;slightly edited code&lt;/P&gt;&lt;P&gt;and also just a guess, check in leader settings number&lt;/P&gt;&lt;P&gt;of allowed verices manually&lt;/P&gt;&lt;P&gt;Type Leader in the command line then type S to see the things&lt;/P&gt;&lt;P&gt;Here is your code:&lt;/P&gt;&lt;PRE&gt;        &amp;lt;CommandMethod("DrawAnnoLeader", "dal", CommandFlags.Modal + CommandFlags.Redraw)&amp;gt; _
        Public Sub TestLeader()
            Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

            Dim acCurDb As Database = acDoc.Database

            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                Dim acBlkTbl As BlockTable

                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)

                Dim acBlkTblRec As BlockTableRecord

                acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)

                'Create the MText annotation            

                Dim acMText As MText = New MText()

                acMText.SetDatabaseDefaults()

                acMText.Layer = "TEXT"

                acMText.Contents = "contents"

                'pt is a function that returns a Point3d(x, y, z) where z = 0﻿
                acMText.Location = New Point3d(15, 15, 0)
                'acMText.Location = pt(endPt.X + 2, endPt.Y + acMText.ActualHeight / 2)

                acMText.Width = 70

                'Add the new object to Model space and the transaction             

                acBlkTblRec.AppendEntity(acMText)

                acTrans.AddNewlyCreatedDBObject(acMText, True)

                'Create the leader          

                Dim acLdr As Leader = New Leader()

                acLdr.SetDatabaseDefaults()

                acLdr.Layer = "DIM"

                'acLdr.AppendVertex(startPt)

                'acLdr.AppendVertex(breakPt)

                'acLdr.AppendVertex(endPt)
                acLdr.AppendVertex(New Point3d(0, 0, 0))
                acLdr.AppendVertex(New Point3d(14, 14, 0))
                ' ldr.AppendVertex(New Point3d(4, 5, 0))

                acLdr.HasArrowHead = True

                'Add the new object to Model space and the transaction

                acBlkTblRec.AppendEntity(acLdr)

                acTrans.AddNewlyCreatedDBObject(acLdr, True)

                'Attach the annotation after the leader object is added

                acLdr.Annotation = acMText.ObjectId

                acLdr.EvaluateLeader()

                acTrans.Commit()

            End Using

        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2012 20:09:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371343#M56849</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-14T20:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371789#M56850</link>
      <description>&lt;P&gt;Why don't you use MLeader instead? Seems to be far easier to me at least&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 06:01:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3371789#M56850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-15T06:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372105#M56851</link>
      <description>&lt;P&gt;Thank you Hallex but I am still getting the same exception, eInputInvalid.&amp;nbsp; Not that I am ready to give up on this but what about the MLeader suggestion?&amp;nbsp; I did a quick search in the Developer's Guide and didn't see any reference for it.&amp;nbsp;The good news is the leader and mtext are working, I just can't associate&amp;nbsp;them so it's not the end of the world but there is always an explanation to these type of issues.&amp;nbsp; Your feedback is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 12:43:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372105#M56851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-15T12:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372277#M56852</link>
      <description>&lt;P&gt;Ken here is a sample to create mleader,&lt;/P&gt;&lt;P&gt;see if this is working on your end&lt;/P&gt;&lt;PRE&gt;    &amp;lt;CommandMethod("MLDF")&amp;gt; _
    Public Sub MleaderTest()
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim ed As Editor = doc.Editor
        Dim db As Database = doc.Database
        Dim ucs As Matrix3d = ed.CurrentUserCoordinateSystem
        Dim dimld As Object = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("dimldrblk")
        Using tr As Transaction = db.TransactionManager.StartTransaction()
            Try
                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("dimldrblk", ".")
                Dim arrowPoint As Point3d = ed.GetPoint(vbLf &amp;amp; "Pick a point for the arrowhead: ").Value
                Dim pto As New PromptPointOptions(vbLf &amp;amp; "Pick a point for text: ")
                pto.UseBasePoint = True
                pto.UseDashedLine = True
                pto.BasePoint = arrowPoint
                Dim symbolPoint As Point3d = ed.GetPoint(pto).Value
                Dim vec As Vector3d
                If arrowPoint.X &amp;lt;= symbolPoint.X Then
                    vec = New Vector3d(1, 0, 0)
                Else
                    vec = New Vector3d(-1, 0, 0)
                End If
                Dim btr As BlockTableRecord = DirectCast(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
                Dim th As Double = db.Dimtxt
                Dim mtxt As New MText()
                mtxt.SetDatabaseDefaults()
                mtxt.Attachment = If(vec = New Vector3d(1, 0, 0), AttachmentPoint.MiddleLeft, AttachmentPoint.MiddleRight)
                mtxt.TextHeight = th
                mtxt.Width = 0.0
                mtxt.Contents = "Line 1\PLine 2\PLine 3"

                Dim mldr As New MLeader()
                mldr.LeaderLineType = LeaderType.StraightLeader
                ' --- add other properties here --- 

                mldr.AddLeaderLine(arrowPoint)
                mldr.AddFirstVertex(0, arrowPoint)
                mldr.AddFirstVertex(1, symbolPoint)
                mldr.ArrowSymbolId = db.Dimldrblk

                Dim dict As DBDictionary = DirectCast(tr.GetObject(db.MLeaderStyleDictionaryId, OpenMode.ForRead), DBDictionary)
                Dim mlstyleid As ObjectId = dict.GetAt("Standard")
                mldr.MLeaderStyle = mlstyleid
                mldr.ContentType = ContentType.MTextContent

                mldr.MText = mtxt
                mldr.TextLocation = symbolPoint
                mldr.SetDogleg(0, vec)
                mldr.LandingGap = th / 4
                mldr.DoglegLength = th

                btr.AppendEntity(mldr)
                tr.AddNewlyCreatedDBObject(mldr, True)
                tr.Commit()
            Catch ex As Autodesk.AutoCAD.Runtime.Exception
                ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)
            Finally
                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("dimldrblk", dimld)
            End Try
        End Using
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 14:29:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372277#M56852</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-15T14:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372351#M56853</link>
      <description>&lt;P&gt;Hallex ... Your test MLeader worked!&amp;nbsp; Thanks to TobyRsenberg8728 for the suggestion!&amp;nbsp; Is there any reason why I shouldn't mark this as a workable solution?&amp;nbsp; Also, should this be reported as a bug on AutoCAD 2012 considering the example code in the Developer's Guide does not work as written?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 14:55:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372351#M56853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-15T14:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372467#M56854</link>
      <description>&lt;P&gt;Ken,&lt;/P&gt;&lt;P&gt;You wrote:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;Also, should this be reported as a bug on AutoCAD 2012 considering the example code in the Developer's Guide does not work as written?&lt;/P&gt;&lt;P&gt;Don't hurry up, I'm still working on this issue, just a guess, maybe&lt;/P&gt;&lt;P&gt;you need to look at any ...ASSOC system variables&lt;/P&gt;&lt;P&gt;Keep watching for,&lt;/P&gt;&lt;P&gt;Regardfs,&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 15:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372467#M56854</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-15T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372577#M56855</link>
      <description>&lt;P&gt;In addition&lt;/P&gt;&lt;P&gt;I can not reconstruct the same issue here&lt;/P&gt;&lt;P&gt;what from my investigating is DIMASSOC variable&lt;/P&gt;&lt;P&gt;does not effect at all, the leader mtext stll associative&lt;/P&gt;&lt;P&gt;undependently&lt;/P&gt;&lt;P&gt;So sorry I don't know how to solve this problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 16:40:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372577#M56855</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-15T16:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372595#M56856</link>
      <description>&lt;P&gt;Hallex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's quite alright.&amp;nbsp; I have 2 options now, MLeader or&amp;nbsp;&amp;nbsp;non-associated MText +&amp;nbsp;Leader,&amp;nbsp;so I will be able to proceed.&amp;nbsp; Although the MLeader is an option and not a fix to the underlying issue, do you think I should mark&amp;nbsp;this thread&amp;nbsp;as answered?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 16:48:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372595#M56856</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-15T16:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372775#M56857</link>
      <description>&lt;P&gt;Happy to help, Ken&lt;/P&gt;&lt;P&gt;Happy computing,&lt;/P&gt;&lt;P&gt;Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2012 18:19:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3372775#M56857</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-15T18:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: MText Associativity Exception</title>
      <link>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3526606#M56858</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code example above works well but I use Annotative Text.&amp;nbsp; This means the line&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; th &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Double&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = db.Dimtxt&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;returns a text ht that doesn't factor in the Annotative scale.&amp;nbsp; Is there a work around for this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;Thanks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2012 16:05:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/mtext-associativity-exception/m-p/3526606#M56858</guid>
      <dc:creator>Hugh_Compton</dc:creator>
      <dc:date>2012-07-04T16:05:27Z</dc:date>
    </item>
  </channel>
</rss>

