<?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 Block Created and Inserted Shows Text Entities at Origin Until Regen'd By User in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3602384#M53521</link>
    <description>&lt;P&gt;I've written a method that creates a block definition and inserts one instance the newly created block definition. &amp;nbsp;The block is&amp;nbsp;&lt;SPAN&gt;comprised exclusively of lines and text entities. &amp;nbsp;When the method is completed, all entities appear correctly on my machine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, when other users try to run the routine on their machines, the lines appear correctly but the text entities all appear positioned at the block insertion's origen. &amp;nbsp;And the other users must manually regen the drawing after the command is run to trigger the text entities to move (or appear to move) into their proper location.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Though it wasn't necessary on my machine, I tried adding &lt;SPAN&gt;the following line&amp;nbsp;&lt;/SPAN&gt;as the last instruction in my command-method:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;_drawing.Editor.Regen();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But even that last line's programmatically-triggered regen didn't solve the text location issue for my users. &amp;nbsp;They still have to manually regen.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also ensured that all (or most) of a test user's system variables were set to the same values that I use (via Express Tools export &amp;amp; import). &amp;nbsp;But that didn't help either.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm at a loss as to what could possibly be causing the discrepant behavior. &amp;nbsp;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;THANKS!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2012 23:50:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-08-30T23:50:45Z</dc:date>
    <item>
      <title>Block Created and Inserted Shows Text Entities at Origin Until Regen'd By User</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3602384#M53521</link>
      <description>&lt;P&gt;I've written a method that creates a block definition and inserts one instance the newly created block definition. &amp;nbsp;The block is&amp;nbsp;&lt;SPAN&gt;comprised exclusively of lines and text entities. &amp;nbsp;When the method is completed, all entities appear correctly on my machine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, when other users try to run the routine on their machines, the lines appear correctly but the text entities all appear positioned at the block insertion's origen. &amp;nbsp;And the other users must manually regen the drawing after the command is run to trigger the text entities to move (or appear to move) into their proper location.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Though it wasn't necessary on my machine, I tried adding &lt;SPAN&gt;the following line&amp;nbsp;&lt;/SPAN&gt;as the last instruction in my command-method:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;_drawing.Editor.Regen();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But even that last line's programmatically-triggered regen didn't solve the text location issue for my users. &amp;nbsp;They still have to manually regen.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also ensured that all (or most) of a test user's system variables were set to the same values that I use (via Express Tools export &amp;amp; import). &amp;nbsp;But that didn't help either.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm at a loss as to what could possibly be causing the discrepant behavior. &amp;nbsp;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;THANKS!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2012 23:50:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3602384#M53521</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-30T23:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3603328#M53522</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;are you really speaking about TEXT-objects in the BlockReference or are these object AttributeReferences?&lt;/P&gt;&lt;P&gt;If you run your code that inserts the BlockReference and then start &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;_AUDIT&lt;/FONT&gt; instead of any other command like &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;_REGEN&lt;/FONT&gt; ...does AutoCAD bring up any database-errors?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code-snippet would be great to see&lt;/P&gt;&lt;P&gt;The version of AutoCAD + ServicePack (pluse vertical information if it's a vertical product) may also help&lt;/P&gt;&lt;P&gt;To check the gc, maybe to toggle the hardware-acceleration is always a good idea. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 15:47:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3603328#M53522</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-08-31T15:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3603780#M53523</link>
      <description>&lt;P&gt;Thanks for the feedback. &amp;nbsp;I haven't had time to follow up on this fully yet. &amp;nbsp;And I probably won't get around to it until after the holiday weekend.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, we did determine that if AutoCAD is launced to the VANILLA profile rather than the ACADMPP profile, it does indeed work correctly for my users. &amp;nbsp;I personally use the vanilla profile and haven't tested it in the mechanical profile on my machine. &amp;nbsp;And AutoCAD has to be launched to the vanilla profile rather than merely settting the vanilla profile current during the session.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll investigate further on Tuesday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 20:25:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3603780#M53523</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-31T20:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3606902#M53524</link>
      <description>&lt;P&gt;&lt;SPAN&gt;AUDIT didn't reveal any errors. &amp;nbsp;We're running AutoCAD Mechanical 2011 Version 3 (E.208.0.0). &amp;nbsp;The block only contains TEXT entities (i.e., there are no ATTDEFs).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2012 20:18:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3606902#M53524</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-04T20:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3607216#M53525</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please post the code, in particular the block definition part of the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 01:39:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3607216#M53525</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2012-09-05T01:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608088#M53526</link>
      <description>&lt;P&gt;There are about 1500 lines of code involved in the generation of these blocks. &amp;nbsp;And I really don't have time now to simplify this code simply to post it here. &amp;nbsp;I have however attached an image which shows the resulting blocks (highlighted in yellow). &amp;nbsp;But I suspect that my block-generation code is not source of the discrepant behavior between AutoCAD Vanilla and Mechanical; I'm not sure though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 15:23:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608088#M53526</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T15:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608266#M53527</link>
      <description>&lt;P&gt;Show us just a code block where you do create the&amp;nbsp;text within block&lt;/P&gt;&lt;P&gt;with all text settings, it's enough to see the problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 16:41:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608266#M53527</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T16:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608342#M53528</link>
      <description>&lt;P&gt;Ok,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the main procedure.&lt;/P&gt;&lt;PRE&gt;        public void ConstructMatrix() {
            HubAssemblyMatrix.EraseHubAssemblyMatrix(_document);
            Application.UpdateScreen();
            _matrixData = _matrixBuilder.BuildMatrixData();
            GetInsertionPointAndScaleFactor();
            _metrics = new MatrixPositionMetrics(_matrixData);
            using (var transaction = _database.TransactionManager.StartTransaction()) {
                var blockTable = (BlockTable)transaction.GetObject(_database.BlockTableId, OpenMode.ForRead);
                var blockTableRecord = new BlockTableRecord() { Name = HubAssemblyMatrix.MatrixBlockName };
                blockTable.UpgradeOpen();
                var blockTableRecordId = blockTable.Add(blockTableRecord);
                transaction.AddNewlyCreatedDBObject(blockTableRecord, true);
                using (var entities = ConstructEntities()) {
                    foreach (var entity in entities.OfType&amp;lt;Entity&amp;gt;()) {
                        blockTableRecord.AppendEntity(entity);
                        transaction.AddNewlyCreatedDBObject(entity, true);
                    }
                }
                var modelSpace = (BlockTableRecord)transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                var blockReference = new BlockReference(_insertionPoint, blockTableRecordId);
                blockReference.SetDatabaseDefaults();
                blockReference.ScaleFactors = new Scale3d(_scaleFactor);
                blockReference.LayerId = _layerObjectIdZero;
                modelSpace.AppendEntity(blockReference);
                transaction.AddNewlyCreatedDBObject(blockReference, true);
                transaction.Commit();
            }
            Application.UpdateScreen();
            _document.Editor.Regen(); //Added because Naomi's machine required a regen after completion
        }&lt;/PRE&gt;&lt;P&gt;Entity and text construction:&lt;/P&gt;&lt;PRE&gt;        private DBObjectCollection ConstructEntities() {
            _entities = new DBObjectCollection();
            AddVerticalLines();
            AddHorizontalLines();
            AddText();
            foreach (var entity in _entities.OfType&amp;lt;Entity&amp;gt;()) {
                entity.LayerId = _layerObjectIdBorder;
            }
            return _entities;
        }

        private void AddText() {
            _textStyleIdTahoma = TextStyle.StandardTextStyle.Tahoma.EnsureExists(_document);
            _textStyleIdTahomaBold = TextStyle.StandardTextStyle.TahomaBold.EnsureExists(_document);
            AddRowLabels();
            AddPartRevisionWeightAndStandout();
            if (_matrixData.Type == MatrixData.MatrixType.WithDrum)
                AddBrakeDrumDimensions();
            if (_matrixData.HasChildHubAssemblies)
                AddComponentHubAssemblyNumbers();
            AddXs();
            AddItemQuantityUnitPartNumberDescriptionAndMaterial();
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Text style creator:&lt;/P&gt;&lt;PRE&gt;        public static ObjectId EnsureExists(this StandardTextStyle textStyle, Document document) {
            var database = document.Database;
            using (document.LockDocument()) {
                using (Transaction transaction = database.TransactionManager.StartTransaction()) {
                    var textStyleTable = (TextStyleTable)transaction.GetObject(database.TextStyleTableId, OpenMode.ForRead);
                    var styleName = textStyle.ToStyleName();
                    if (textStyleTable.Has(styleName))
                        return textStyleTable[styleName];
                    textStyleTable.UpgradeOpen();
                    var textStyleTableRecord = new TextStyleTableRecord() {
                        Font = new FontDescriptor(textStyle.ToTypeface(), textStyle.IsBold(), false, textStyle.ToCharacterSet(), textStyle.ToPitchAndFamily()),
                        Name = styleName,
                        FileName = textStyle.ToPathFileNameValidated()
                    };
                    var textStyleObjectId = textStyleTable.Add(textStyleTableRecord);
                    transaction.AddNewlyCreatedDBObject(textStyleTableRecord, true);
                    transaction.Commit();
                    return textStyleObjectId;
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And finally some text creation&lt;/P&gt;&lt;PRE&gt;        private void AddPartRevisionWeightAndStandout() {
            double positionX = -(_metrics.PartNumberColumnWidth / 2D);
            foreach (var item in _matrixData.RevisionWeightStandouts) {
                AddTextItemCenteredBold(positionX, _rowCenters.Revision, item.Revision);
                AddTextItemCenteredBold(positionX, _rowCenters.HubAssemblyNumber, item.HubAssemblyNumber);
                AddTextItemCenteredLight(positionX, _rowCenters.Weight, item.Weight);
                if (_matrixData.HasWheelStuds)
                    AddTextItemCenteredLight(positionX, _rowCenters.WheelStudStandout, item.WheelStudStandout);
                positionX -= _metrics.PartNumberColumnWidth;
            }
        }


        private void AddTextItemCenteredBold(double positionX, double positionY, string text) {
            AddTextItemCentered(positionX, positionY, text, _textStyleIdTahomaBold);
        }

        private void AddTextItemCentered(double positionX, double positionY, string text, ObjectId textStyleId) {
            AddTextItem(positionX, positionY, text, textStyleId, AttachmentPoint.MiddleCenter);
        }


        private void AddTextItem(double positionX, double positionY, string text, ObjectId textStyleId, AttachmentPoint attachmentPoint) {
            var textEntity = new DBText();
            textEntity.SetDatabaseDefaults();
            textEntity.ColorIndex = Colors.ColorIndex.White.ToInt();
            textEntity.Height = _metrics.TextHeight;
            textEntity.Justify = attachmentPoint;
            textEntity.TextString = text;
            textEntity.AlignmentPoint = new Point3d(positionX, positionY, 0);
            textEntity.TextStyleId = textStyleId;
            _entities.Add(textEntity);

        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hopefully the foregoing code blocks shed some light on my doings. &amp;nbsp;However, I still question why the regen behavior (or lack thereof) would be different between the Vanilla and Mechanical profiles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 17:25:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608342#M53528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T17:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608454#M53529</link>
      <description>&lt;P&gt;I tested your command to create text,&lt;/P&gt;&lt;P&gt;guess the problem is on you do justify text&lt;/P&gt;&lt;P&gt;before of specifying the text position&lt;/P&gt;&lt;P&gt;so try this instead&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;       private void AddTextItem(double positionX, double positionY, string text, ObjectId textStyleId, AttachmentPoint attachmentPoint)
        {
            var textEntity = new DBText();
            textEntity.SetDatabaseDefaults();
            textEntity.ColorIndex = Colors.ColorIndex.White.ToInt();
            textEntity.Height = _metrics.TextHeight;
            
            textEntity.TextString = text;
            textEntity.Position = new Point3d(positionX, positionY, 0);
            textEntity.Justify = attachmentPoint;
            textEntity.AlignmentPoint = new Point3d(positionX, positionY, 0);
            textEntity.TextStyleId = textStyleId;
            _entities.Add(textEntity);
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 18:18:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608454#M53529</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T18:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608702#M53530</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hmmm, your suggestion does &lt;SPAN&gt;indeed&amp;nbsp;&lt;/SPAN&gt;affect behavior in the Mechanical profile. &amp;nbsp;However, it doesn't completely fully correct it. &amp;nbsp;In Mechanical, text position is now initially correct; but text alignment is not initially correct (until subsequently manually regenerated). &amp;nbsp;See the attached image.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also have another routine that exhibits similarly discrepant behavior between the Mechanical and Vanilla profiles. &amp;nbsp;In this case, my code draws BOM-item/balloon highlighter entites (a faded-yellow polyline and a hatch). &amp;nbsp;And it draws them iteratively with a pause to enable the user to manually verify the correspondence of the item numbers. &amp;nbsp;In AutoCAD Vanilla these highlighter entities are drawn at full scale and positioned properly; but in Mechanical profile, they are not visible unless the routine is exited.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I assume the two problems are related.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's the code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;namespace ConMetAutoCadLibrary {
    public static class HubAssemblyMatrixChecker {

        /// &amp;lt;summary&amp;gt;
        /// Highlights each bom-item row and corresponding callout bubble pausing for user verification
        /// &amp;lt;/summary&amp;gt;
        public static void CheckBomItemBalloonNumbersViaSuccessiveHighlight() {
            var document = Drawing.ActiveDocument();
            var drawingRevision = Border.DetermineDrawingNumberAndRevision(Drawing.ActiveDocument());
            if (drawingRevision.DrawingNumber == default(string))
                throw new ApplicationException("A part number (i.e., the matrix drawing number) cannot be extracted from either the drawing name or the border attributes\nTherefore a hub assembly matrix BOM-items cannot be successively highlighted");
            if (drawingRevision.Revision == default(string))
                throw new ApplicationException("A revision cannot be extracted from either the drawing name or the border attribute\nTherefore a hub assembly matrix BOM-items cannot be successively highlighted");
            var cultureInfo = CultureInfo.CreateSpecificCulture("en-US");
            var matrixBuilder = new MatrixDataBuilder(drawingRevision.DrawingNumber, drawingRevision.Revision, MatrixData.TargetApplication.AutoCAD, MatrixData.DisplayUnits.English, cultureInfo);
            var matrixData = matrixBuilder.BuildMatrixData();
            //CursorExtensions.SetWaitCursor(() =&amp;gt; { matrixData = matrixBuilder.BuildMatrixData(); });
            var metrics = new HubAssemblyMatrixGenerator.MatrixPositionMetrics(matrixData);
            var insertionPointAndScaleFactor = HubAssemblyMatrix.GetHubAssemblyMatrixInsertionPointAndScaleFactor(document);
            var xOffset = insertionPointAndScaleFactor.InsertionPoint.X;
            var yOffset = insertionPointAndScaleFactor.InsertionPoint.Y;
            double yPosition = yOffset;
            var groups = matrixData.BomItems.GroupBy(_ =&amp;gt; _.BalloonNumber);
            var transparency = new Transparency(75);
            Layer.EnsureLayerConstructionSilent(false);
            //var objectIdCollection = new ObjectIdCollection();
            var dbObjectCollection = new DBObjectCollection();
            foreach (var group in groups) {
                var rowHeight = (metrics.MatrixBOMRowHeight * group.Count()) * insertionPointAndScaleFactor.ScaleFactor;
                yPosition += (rowHeight / 2D);
                //objectIdCollection.Clear();
                dbObjectCollection.Clear();
                var layerId = Layer.StandardLayer.Construction.GetObjectId(document);
                using (var transaction = document.TransactionManager.StartTransaction()) {
                    var blockTable = transaction.GetObject(document.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
                    var blockTableRecord = transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                    var polyline = new Polyline();
                    polyline.SetDatabaseDefaults();
                    polyline.AddVertexAt(0, new Point2d(xOffset, yPosition), 0, 0, 0);
                    polyline.AddVertexAt(1, new Point2d(xOffset + metrics.RightLineOffsetMaterial * insertionPointAndScaleFactor.ScaleFactor, yPosition), 0, 0, 0);
                    polyline.Transparency = transparency;
                    polyline.LayerId = layerId;
                    polyline.ColorIndex = Colors.ColorIndex.Yellow.ToInt();
                    polyline.ConstantWidth = rowHeight;
                    dbObjectCollection.Add(polyline); blockTableRecord.AppendEntity(polyline);
                    //objectIdCollection.Add(blockTableRecord.AppendEntity(polyline));
                    transaction.AddNewlyCreatedDBObject(polyline, true);

                    //all 1 and 2 character numeric single-line text entities
                    var numberTextEntities = Texts.GetAllTextEntitiesSingleLine(document.Editor, true).ToDbObjects&amp;lt;DBText&amp;gt;(transaction).Where(_ =&amp;gt; _.TextString.Length &amp;lt; 3 &amp;amp;&amp;amp; _.TextString.All(c =&amp;gt; Char.IsNumber(c)));
                    var hatches = HighlightRevisionBubble(document, group.First().BalloonNumber, transparency, insertionPointAndScaleFactor.ScaleFactor, numberTextEntities, layerId);
                    hatches.Apply(hatch =&amp;gt; {
                        //var hatchId = blockTableRecord.AppendEntity(hatch);
                        //objectIdCollection.Add(hatchId);
                        dbObjectCollection.Add(hatch); blockTableRecord.AppendEntity(hatch);
                        transaction.AddNewlyCreatedDBObject(hatch, true);
                    });

                    transaction.Commit();
                    //document.Editor.UpdateScreen();
                    document.Editor.Regen(); //Added because Mechanical profile behaves differently than the Vanilla profile
                }

                var promptResult = document.Editor.GetString("Press ENTER to continue or ESCAPE to quit or any letter to retain");
                if (promptResult.Status != PromptStatus.OK) {
                    return;
                }

                using (var transaction = document.StartTransaction()) {
                    //Both .Reverse() and .Highlight() needed or .Erase() line will crash with =&amp;gt; INTERNAL ERROR: !dbobji.cpp@7316: eNotOpenForWrite
                    foreach (var dbObject in dbObjectCollection.OfType&amp;lt;DBObject&amp;gt;().Reverse()) {
                        var entity = transaction.GetEntity(dbObject.ObjectId, OpenMode.ForWrite);
                        entity.Highlight(); //Needed (with .Reverse() above) or next line will crash with =&amp;gt; INTERNAL ERROR: !dbobji.cpp@7316: eNotOpenForWrite
                        if (string.IsNullOrWhiteSpace(promptResult.StringResult)) {
                            entity.Erase();
                        }
                        else {
                            entity.ColorIndex = Colors.ColorIndex.Magenta.ToInt();
                        }
                    }
                    transaction.Commit();
                }
                document.Editor.UpdateScreen();
                //document.Editor.Regen(); //Added because Mechanical profile behaves differently than the Vanilla profile

                yPosition += (rowHeight / 2D);
            }
        }

        private static IEnumerable&amp;lt;Hatch&amp;gt; HighlightRevisionBubble(Document document, int balloonNumber, Transparency transparency, double scaleFactor, IEnumerable&amp;lt;DBText&amp;gt; numberTextEntities, ObjectId layerId) {
            var listOfHatches = new List&amp;lt;Hatch&amp;gt;();
            using (var transaction = document.StartTransaction()) {
                var possibleBalloonTexts = numberTextEntities.Where(_ =&amp;gt; _.TextString == balloonNumber.ToString()).ToArray();
                if (possibleBalloonTexts.Any()) {
                    var possibleBalloonCircles = GetAllPotentialBalloonCircles(document, transaction, scaleFactor);
                    foreach (var possibleBalloonText in possibleBalloonTexts) {
                        var surroundingCircle = GetSurroundingCircle(possibleBalloonCircles, possibleBalloonText, scaleFactor);
                        if (surroundingCircle != default(Circle))
                            listOfHatches.Add(HighlightBalloon(surroundingCircle, transparency, layerId));
                    }
                }
            }
            return listOfHatches;
        }

        private static List&amp;lt;Circle&amp;gt; GetAllPotentialBalloonCircles(Document document, Transaction transaction, double scaleFactor) {
            var listOfCircles = new List&amp;lt;Circle&amp;gt;();
            var blockTable = transaction.GetObject(document.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
            var modelSpace = transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
            var minRadius = scaleFactor * .14;
            var maxRadius = scaleFactor * .3;
            foreach (var objectId in modelSpace) {
                var circle = transaction.GetEntity(objectId, OpenMode.ForRead) as Circle;
                if (circle == null)
                    continue;
                if (circle.Radius &amp;gt; minRadius &amp;amp;&amp;amp; circle.Radius &amp;lt; maxRadius) {
                    listOfCircles.Add(circle);
                }
            }
            return listOfCircles;
        }

        private static Circle GetSurroundingCircle(List&amp;lt;Circle&amp;gt; possibleBalloonCircles, DBText possibleBalloonText, double scaleFactor) {
            if (possibleBalloonText.Bounds.HasValue) {
                var tolerance = 0.04 * scaleFactor;
                var x = (possibleBalloonText.Bounds.Value.MinPoint.X + possibleBalloonText.Bounds.Value.MaxPoint.X) / 2D;
                var y = (possibleBalloonText.Bounds.Value.MinPoint.Y + possibleBalloonText.Bounds.Value.MaxPoint.Y) / 2D;
                return possibleBalloonCircles.Where(_ =&amp;gt; (Math.Abs(x - _.Center.X) &amp;lt; tolerance) &amp;amp;&amp;amp; Math.Abs(y - _.Center.Y) &amp;lt; tolerance).OrderBy(_ =&amp;gt; _.Radius).FirstOrDefault();
            }
            else
                return default(Circle);
        }

        private static Hatch HighlightBalloon(Circle surroundingCircle, Transparency transparency, ObjectId layerId) {
            var hatch = new Hatch();
            hatch.SetDatabaseDefaults();
            hatch.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
            hatch.Associative = false;
            hatch.LayerId = layerId;
            hatch.ColorIndex = Colors.ColorIndex.Yellow.ToInt();
            hatch.Transparency = transparency;
            var objectIdCollection = new ObjectIdCollection();
            objectIdCollection.Add(surroundingCircle.ObjectId);
            hatch.AppendLoop(HatchLoopTypes.Outermost, objectIdCollection);
            hatch.EvaluateHatch(true);
            return hatch;
        }


    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 20:47:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608702#M53530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T20:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608722#M53531</link>
      <description>&lt;P&gt;Sorry I can't help with it,&lt;/P&gt;&lt;P&gt;just an idea &amp;gt; try ed.UpdateScreen(); at the end of code&lt;/P&gt;&lt;P&gt;currently I just have a AutoCAD 2010 on my machine installed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 21:02:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608722#M53531</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T21:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608742#M53532</link>
      <description>&lt;P&gt;Yeah thanks...I have tried that and also with Editor.Regen()'s interspersed before and after. &amp;nbsp; So far to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 21:11:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3608742#M53532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T21:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Block Created and Inserted Shows Text Entities at Origin Until Regen'd By Us</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3616718#M53533</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is quite hard to say what might be causing it with&amp;nbsp;only the code snippet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try using the DBText.adjustAlignment method.&lt;/P&gt;
&lt;P&gt;This is the explanation for this method from the documentation :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"....if the text entity is embedded in another entity, it will never be closed in &lt;BR /&gt;which case it won't automatically be adjusted....."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you have side database, then ensure that it is the working database before calling the adjustAlignment method.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 12:42:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-created-and-inserted-shows-text-entities-at-origin-until/m-p/3616718#M53533</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-09-12T12:42:15Z</dc:date>
    </item>
  </channel>
</rss>

