<?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 Can't set MTextAttributeDefinition.Width in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/can-t-set-mtextattributedefinition-width/m-p/6453841#M35197</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to change the MTextAttributeDefinition.Width by code, but it does&amp;nbsp;not work, the code is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public static void UpdateMTextAttribute(this Database db, string blockName, string attName, ObjectId textStyleId, double height, double widthFactor, double width)
        {
            BlockTable bt = (BlockTable)db.BlockTableId.GetObject(OpenMode.ForRead);
            ObjectId btrID = bt[blockName];
            BlockTableRecord btr = (BlockTableRecord)btrID.GetObject(OpenMode.ForRead);
            foreach (ObjectId id in btr)
            {
                AttributeDefinition attDef = id.GetObject(OpenMode.ForRead) as AttributeDefinition;
                if (attDef != null &amp;amp;&amp;amp; attDef.Tag == attName)
                {
                    attDef.UpgradeOpen();
                    attDef.TextStyleId = textStyleId;
                    attDef.Height = height;
                    attDef.WidthFactor = widthFactor;
                    attDef.MTextAttributeDefinition.Width = width;
                    attDef.DowngradeOpen();
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;During debugging I can see the TextStyleId, Height and WidthFactor all changed, but MTextAttributeDefinition.Width still has the original value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I change it by code? Thanks very much?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2016 08:19:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-07-22T08:19:24Z</dc:date>
    <item>
      <title>Can't set MTextAttributeDefinition.Width</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-set-mtextattributedefinition-width/m-p/6453841#M35197</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to change the MTextAttributeDefinition.Width by code, but it does&amp;nbsp;not work, the code is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public static void UpdateMTextAttribute(this Database db, string blockName, string attName, ObjectId textStyleId, double height, double widthFactor, double width)
        {
            BlockTable bt = (BlockTable)db.BlockTableId.GetObject(OpenMode.ForRead);
            ObjectId btrID = bt[blockName];
            BlockTableRecord btr = (BlockTableRecord)btrID.GetObject(OpenMode.ForRead);
            foreach (ObjectId id in btr)
            {
                AttributeDefinition attDef = id.GetObject(OpenMode.ForRead) as AttributeDefinition;
                if (attDef != null &amp;amp;&amp;amp; attDef.Tag == attName)
                {
                    attDef.UpgradeOpen();
                    attDef.TextStyleId = textStyleId;
                    attDef.Height = height;
                    attDef.WidthFactor = widthFactor;
                    attDef.MTextAttributeDefinition.Width = width;
                    attDef.DowngradeOpen();
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;During debugging I can see the TextStyleId, Height and WidthFactor all changed, but MTextAttributeDefinition.Width still has the original value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I change it by code? Thanks very much?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 08:19:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-set-mtextattributedefinition-width/m-p/6453841#M35197</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-22T08:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set MTextAttributeDefinition.Width</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-set-mtextattributedefinition-width/m-p/8135567#M35198</link>
      <description>&lt;P&gt;MText mText = attDef.MTextAttributeDefinition;&lt;BR /&gt;mText.Width = width;&lt;BR /&gt;&lt;SPAN&gt;attDef&lt;/SPAN&gt;.MTextAttributeDefinition = mText;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 14:42:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-set-mtextattributedefinition-width/m-p/8135567#M35198</guid>
      <dc:creator>dylanswan3dvrs</dc:creator>
      <dc:date>2018-07-17T14:42:24Z</dc:date>
    </item>
  </channel>
</rss>

