<?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: Text Height Update In C Sharp in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7746374#M27659</link>
    <description>&lt;P&gt;What does false do in&amp;nbsp; "THU ", false, false, false.&lt;/P&gt;
&lt;P&gt;I never did find any information true/false keywords on that in the Autodesk webpages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 13:28:14 GMT</pubDate>
    <dc:creator>muckmailer</dc:creator>
    <dc:date>2018-02-02T13:28:14Z</dc:date>
    <item>
      <title>Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739626#M27646</link>
      <description>&lt;P&gt;The following Lisp route will update text by style. Can this be done in C sharp?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for a c sharp routine that would have an select all&amp;nbsp;so I can make changes to all text in the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;;  TextHeightUpdate.lsp [command name: THU]
;;  To Update the Height of Text and Mtext in Styles with defined heights,
;;    when height has been changed in Style definition.  Checks Style of all
;;    selected Text/Mtext, and it has a defined height, imposes that on object.
(defun C:THU (/ ss n obj ht)
  (prompt "\nTo Update the Height of fixed-height Text/Mtext,")
  (if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
    (repeat (setq n (sslength ss))
      (setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n)))))
      (if
        (&amp;gt; (setq ht (cdr (assoc 40 (tblsearch "style" (vla-get-StyleName obj))))) 0)
        (vla-put-Height obj ht); then
      ); if
    ); repeat
  ); if
  (princ)
); defun
(vl-load-com)
(prompt "\nType THU for Text Height Update.")&lt;/PRE&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 13:39:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739626#M27646</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-01-31T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739713#M27647</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say "select all", do you mean:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;in the current space&lt;/LI&gt;
&lt;LI&gt;in all spaces&lt;/LI&gt;
&lt;LI&gt;in all spaces and block definition&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 31 Jan 2018 14:03:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739713#M27647</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-01-31T14:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739897#M27648</link>
      <description>&lt;P&gt;This mimics the LISP except it does a (ssget "_X" ...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("THU")]
        public void TextHeightUpdate()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            
            var filter = new SelectionFilter(new[] { new TypedValue(0, "MTEXT,TEXT") });
            var psr = ed.SelectAll(filter);
            if (psr.Status != PromptStatus.OK)
                return;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                foreach (SelectedObject so in psr.Value)
                {
                    var id = so.ObjectId;
                    if (id.ObjectClass.DxfName == "TEXT")
                    {
                        var text = (DBText)tr.GetObject(id, OpenMode.ForRead);
                        var textStyle = (TextStyleTableRecord)tr.GetObject(text.TextStyleId, OpenMode.ForRead);
                        if (textStyle.TextSize &amp;gt; 0)
                        {
                            tr.GetObject(id, OpenMode.ForWrite);
                            text.Height = textStyle.TextSize;
                        }
                    }
                    else
                    {
                        var mtext = (MText)tr.GetObject(id, OpenMode.ForRead);
                        var textStyle = (TextStyleTableRecord)tr.GetObject(mtext.TextStyleId, OpenMode.ForRead);
                        if (textStyle.TextSize &amp;gt; 0)
                        {
                            tr.GetObject(id, OpenMode.ForWrite);
                            mtext.Height = textStyle.TextSize;
                        }
                    }
                }
                tr.Commit();
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 14:46:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7739897#M27648</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-01-31T14:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7740000#M27649</link>
      <description>&lt;P&gt;Here's an optimization of the previous routine which first collect all the names and heights of textsyles which TextSize is greater than 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("THU")]
        public void TextHeightUpdate()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var textStyles = GetFixedHeightTextStyles(db);
            if (!textStyles.Any())
                return;

            var filter = new SelectionFilter(new[] 
            {
                new TypedValue(0, "MTEXT,TEXT"),
                new TypedValue(7, string.Join(",", textStyles.Keys))
            });
            var psr = ed.SelectAll(filter);
            if (psr.Status != PromptStatus.OK)
                return;

            var textClass = RXObject.GetClass(typeof(DBText));

            using (var tr = db.TransactionManager.StartTransaction())
            {
                foreach (SelectedObject so in psr.Value)
                {
                    var id = so.ObjectId;
                    if (id.ObjectClass.IsDerivedFrom(textClass))
                    {
                        var text = (DBText)tr.GetObject(id, OpenMode.ForWrite);
                        text.Height = textStyles[text.TextStyleName];
                    }
                    else
                    {
                        var mtext = (MText)tr.GetObject(id, OpenMode.ForRead);
                        mtext.Height = textStyles[mtext.TextStyleName];
                    }
                }
                tr.Commit();
            }
        }

        Dictionary&amp;lt;string, double&amp;gt; GetFixedHeightTextStyles(Database db)
        {
            using (var tr = db.TransactionManager.StartOpenCloseTransaction())
            {
                return ((TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead))
                    .Cast&amp;lt;ObjectId&amp;gt;()
                    .Select(id =&amp;gt; (TextStyleTableRecord)tr.GetObject(id, OpenMode.ForRead))
                    .Where(ts =&amp;gt; ts.TextSize &amp;gt; 0.0)
                    .ToDictionary(ts =&amp;gt; ts.Name, ts =&amp;gt; ts.TextSize);
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 15:10:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7740000#M27649</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-01-31T15:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7741257#M27650</link>
      <description>&lt;P&gt;I would like to select all Text, Mtext and I think dtext if&amp;nbsp;in the drawing if that is possable.&lt;/P&gt;
&lt;P&gt;If I could controll include attributes and text in blocks that would be great&amp;nbsp;but I think that would make things too complex.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I plan on putting the routine in a batch loop.&amp;nbsp; I am hoping to eventually control text height, width and maybe style. Especially Height &amp;amp; width.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have modified that ssget in that lisp routine to select all text but I would have to load it and use command send to use it in VS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:35:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7741257#M27650</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-01-31T21:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7741947#M27651</link>
      <description>&lt;P&gt;The above codes select all Texts and Mtexts in the drawing, like: (ssget "_X" '((0 . "TEXT.MTEXT")))&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 06:50:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7741947#M27651</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-01T06:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743102#M27652</link>
      <description>&lt;P&gt;On the last routine I got the following error.&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="Error.PNG" style="width: 429px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/457652i3CF6D6C4AAF26497/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.PNG" alt="Error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:03:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743102#M27652</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-01T14:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743245#M27653</link>
      <description>&lt;P&gt;Please change this line :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var mtext = (MText)tr.GetObject(id, OpenMode.&lt;FONT color="#FF0000"&gt;ForRead&lt;/FONT&gt;);&lt;/PRE&gt;&lt;P&gt;to :&lt;/P&gt;&lt;PRE&gt;var mtext = (MText)tr.GetObject(id, OpenMode.&lt;FONT color="#0000FF"&gt;ForWrite&lt;/FONT&gt;);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:37:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743245#M27653</guid>
      <dc:creator>GiaBach</dc:creator>
      <dc:date>2018-02-01T14:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743656#M27654</link>
      <description>&lt;P&gt;That made it have an e-lock violation.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error1.PNG" style="width: 475px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/457731i4FB3B6983666BE7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error1.PNG" alt="Error1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 16:12:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7743656#M27654</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-01T16:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744147#M27655</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1260455"&gt;@GiaBach&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Please change this line :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var mtext = (MText)tr.GetObject(id, OpenMode.&lt;FONT color="#FF0000"&gt;ForRead&lt;/FONT&gt;);&lt;/PRE&gt;
&lt;P&gt;to :&lt;/P&gt;
&lt;PRE&gt;var mtext = (MText)tr.GetObject(id, OpenMode.&lt;FONT color="#0000FF"&gt;ForWrite&lt;/FONT&gt;);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1260455"&gt;@GiaBach&lt;/a&gt; thanks for correcting this.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 18:24:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744147#M27655</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-01T18:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744163#M27656</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/545222"&gt;@muckmailer&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;That made it have an e-lock violation.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error1.PNG" style="width: 475px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/457731i4FB3B6983666BE7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error1.PNG" alt="Error1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please describe how do you use the command, this error won't occur when calling the THU command from command line.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 18:29:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744163#M27656</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-01T18:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744330#M27657</link>
      <description>&lt;P&gt;I make a form and use allow me to a button.&lt;/P&gt;
&lt;P&gt;Here is the code I have now I think it works. I put lockdoc code in it.&lt;/P&gt;
&lt;PRE&gt;  private void button11_Click(object sender, EventArgs e)
        {
            //ObjMycommands.RemoveTxtOverrides();   
            //Test();
            // ChangeTextsize();
            //SendACommandToAutoCAD();
            TextHeightUpdate();
        }     
       //Update Routine
        public void TextHeightUpdate()
        {
            System.Windows.Forms.MessageBox.Show("THU");
            var doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var textStyles = GetFixedHeightTextStyles(db);
            if (!textStyles.Any())
                return;

            var filter = new SelectionFilter(new[] 
            {
                new TypedValue(0, "MTEXT,TEXT"),
                new TypedValue(7, string.Join(",", textStyles.Keys))
            });
            var psr = ed.SelectAll(filter);
            if (psr.Status != PromptStatus.OK)
                return;

            var textClass = RXObject.GetClass(typeof(DBText));
            using (DocumentLock docLock = doc.LockDocument())
            {


                using (var tr = db.TransactionManager.StartTransaction())
                {
                    foreach (SelectedObject so in psr.Value)
                    {
                        var id = so.ObjectId;
                        if (id.ObjectClass.IsDerivedFrom(textClass))
                        {
                            var text = (DBText)tr.GetObject(id, OpenMode.ForWrite);
                            text.Height = textStyles[text.TextStyleName];
                        }
                        else
                        {
                            //var mtext = (MText)tr.GetObject(id, OpenMode.ForRead);
                            var mtext = (MText)tr.GetObject(id, OpenMode.ForWrite);
                            mtext.Height = textStyles[mtext.TextStyleName];
                        }
                    }
                    tr.Commit();


                }//using
            }
            }//Routine

        Dictionary&amp;lt;string, double&amp;gt; GetFixedHeightTextStyles(Database db)
        {
            using (var tr = db.TransactionManager.StartOpenCloseTransaction())
            {
                return ((TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead))
                    .Cast&amp;lt;ObjectId&amp;gt;()
                    .Select(id =&amp;gt; (TextStyleTableRecord)tr.GetObject(id, OpenMode.ForRead))
                    .Where(ts =&amp;gt; ts.TextSize &amp;gt; 0.0)
                    .ToDictionary(ts =&amp;gt; ts.Name, ts =&amp;gt; ts.TextSize);
            }
        }



//Update Routine&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 19:24:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744330#M27657</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-01T19:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744407#M27658</link>
      <description>&lt;P&gt;The request in the OP was to mimic a LISP command, so I replied with a .NET command.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;I could not guess that you wanted an event handler for a button.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Anyway, Im glad you get it work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;You could avoid using the LockDocument by calling the command from the button event handler (safer way):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;private void button11_Click(object sender, EventArgs e)
{&lt;BR /&gt;    var doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;    if (doc != null)&lt;BR /&gt;        doc.SendStringToExecute("THU ", false, false, false);&lt;BR /&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 19:49:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7744407#M27658</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-01T19:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7746374#M27659</link>
      <description>&lt;P&gt;What does false do in&amp;nbsp; "THU ", false, false, false.&lt;/P&gt;
&lt;P&gt;I never did find any information true/false keywords on that in the Autodesk webpages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 13:28:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7746374#M27659</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-02T13:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7746401#M27660</link>
      <description>&lt;P&gt;Have a look&lt;A href="http://help.autodesk.com/view/OARX/2018/ENU/?guid=OREFNET-Autodesk_AutoCAD_ApplicationServices_Document_SendStringToExecute_string__MarshalAsUnmanagedType_U1__bool__MarshalAsUnmanagedType_U1__bool__MarshalAsUnmanagedType_U1__bool" target="_blank"&gt; &amp;gt;&amp;gt;here &amp;lt;&amp;lt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 13:37:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7746401#M27660</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-02T13:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7747432#M27661</link>
      <description>&lt;P&gt;So if I put your routine in Mycommands and start it with a type-in command I do not have the e-lock problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If place that same routine in a form module that introduces the e-lock violation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it try something like the code I have in button 12 I still have the e-lock violation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So is placing AutoCAD routines in Mycommands and using command send to avoid e-lock violations&lt;BR /&gt;is the preferred menhod if you wnat to use form controls?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I the past I thought they recommand not using command sends. Why is it prefered over &lt;BR /&gt;using LockDocument? Why is that safer?&lt;/P&gt;
&lt;PRE&gt;//Start Update Routine
        private void button11_Click(object sender, EventArgs e)
        {
            var doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
            if (doc != null)
                doc.SendStringToExecute("THU ", false, false, false);
         }
        private void button12_Click(object sender, EventArgs e)
        {
            // This gives elock Violation,
            MyCommands ObjTHUStart = new MyCommands();
            ObjTHUStart.TextHeightUpdate();  
          }
  
  //Start Update Routine   &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 18:31:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7747432#M27661</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-02T18:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7747470#M27662</link>
      <description>&lt;P&gt;Extract from &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2011/02/managing-drag-drop-from-a-palette-into-autocad-using-net.html" target="_blank"&gt;Kean Walmsley blog&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Once again there’s our important &lt;A href="http://en.wikipedia.org/wiki/Rule_of_thumb" target="_blank"&gt;rule of thumb&lt;/A&gt; when it comes to implementing a modeless UI: rather than manually locking the current document, it’s safer to define a command – which will implicitly lock the current document – and call that from the UI via SendStringToExecute().&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'ts safer because you let AutoCAD take care of locking the document (and setting the focus to the AutoCAD window).&lt;/P&gt;
&lt;P&gt;Another advantage is that it also allows the user to hit Enter to re-launch the command.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 18:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7747470#M27662</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-02T18:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749853#M27663</link>
      <description>&lt;P&gt;I would like to expand this routine to also update mtext &amp;amp; text widths&lt;/P&gt;
&lt;P&gt;so I add the following lines to your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;text.Height = textStyles[text.TextStyleName];
text.WidthFactor = textStyles[text.TextStyleName];&lt;BR /&gt; // mtext.How do I know what intellisense keywords do?&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; //var mtext = (MText)tr.GetObject(id, OpenMode.ForRead);&lt;BR /&gt; var mtext = (MText)tr.GetObject(id, OpenMode.ForWrite);&lt;BR /&gt; mtext.Height = textStyles[mtext.TextStyleName];&lt;BR /&gt; //mtext.??? = textStyles[text.TextStyleName];&lt;BR /&gt;// mtext.How do I know what intellisense keywords do?&lt;/PRE&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;So I thinik I might have guessed the&amp;nbsp;text.WidthFactor to for text width but I am puzzled on how the control M text width by looking at&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;intellsense keywords. So how can I control Mtext width in this routine and how know learn how to use effectivly use &lt;BR /&gt;intellisense keywords? How do I learn the intellsense roadmap for AutoCAD? Is there a good guide or tutorial for these words?&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2018 15:56:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749853#M27663</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2018-02-04T15:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749904#M27664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With MText instances, the width factor in MTEXT formatting (\W) which can affect only a portion of the text.&lt;/P&gt;
&lt;P&gt;See &amp;gt;&amp;gt;here&amp;lt;&amp;lt; and &amp;gt;&amp;gt;there&amp;lt;&amp;lt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can easily remove all mtext formatting doing:&lt;/P&gt;
&lt;PRE&gt;mtext.TextString = mtext.Text;&lt;/PRE&gt;
&lt;P&gt;but only removing some formatting is not so trivial.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2018 16:47:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749904#M27664</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-04T16:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Text Height Update In C Sharp</title>
      <link>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749918#M27665</link>
      <description>&lt;P&gt;You can try using regular expression:&lt;/P&gt;
&lt;PRE&gt;var regex = new Regex(@"\\W\d*(\.\d+)?;", RegexOptions.IgnoreCase);
mtext.Contents = regex.Replace(mtext.Contents, "");&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Feb 2018 17:09:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/text-height-update-in-c-sharp/m-p/7749918#M27665</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-02-04T17:09:39Z</dc:date>
    </item>
  </channel>
</rss>

