<?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: eNotInBlock error when running DisplayOrder on Hatches and their boundary loops. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130495#M17307</link>
    <description>&lt;P&gt;Thanks for the help.&amp;nbsp; The Assume doesn't relieve the problem, but now I know what to check so as to avoid the catch.&amp;nbsp; In the long run, it doesn't seem to be causing any downstream problems.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 16:02:55 GMT</pubDate>
    <dc:creator>dennis</dc:creator>
    <dc:date>2021-03-04T16:02:55Z</dc:date>
    <item>
      <title>eNotInBlock error when running DisplayOrder on Hatches and their boundary loops.</title>
      <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130189#M17303</link>
      <description>&lt;P&gt;I have a Hatch Extension that is giving me an error periodically.&amp;nbsp; I do have a catch in place, and when it hits, I get the msg: "eNotInBlock".&amp;nbsp; It appears to not affect at all the successful completion of the code.&amp;nbsp; It is just annoying.&amp;nbsp; Note in the code below, I also have a Database extension that makes it easier for me to run Transactions.&lt;/P&gt;&lt;P&gt;If anyone can shed some light on the error, I would appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        public static void SetDisplayOrder(this Hatch bhatch)
        {
            Database acDb;
            var hatchid = bhatch.ObjectId;
            if (hatchid.IsPerfectlyValid()) acDb = hatchid.Database;
            else return;
            acDb.UsingTransaction(tr =&amp;gt;
            {
                var blktbl = (BlockTable)tr.GetObject(acDb.BlockTableId, OpenMode.ForRead);
                var btr = (BlockTableRecord)tr.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                var hatch = (Hatch)tr.GetObject(hatchid, OpenMode.ForWrite);
                var loopids = hatch.GetAssociatedObjectIds();
                DrawOrderTable dot = (DrawOrderTable)tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite);
                try
                {
                    dot.MoveToBottom(loopids);
                    var idcol = new ObjectIdCollection { hatch.ObjectId };
                    foreach (ObjectId loopid in loopids)
                    {
                        dot.MoveBelow(idcol, loopid);
                    }
                }
                catch (Autodesk.AutoCAD.Runtime.Exception aex)
                {
                    Console.WriteLine(aex.Message);
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                hatch.EvaluateHatch(true);
            });
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 14:49:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130189#M17303</guid>
      <dc:creator>dennis</dc:creator>
      <dc:date>2021-03-04T14:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: eNotInBlock error when running DisplayOrder on Hatches and their boundary loops.</title>
      <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130295#M17304</link>
      <description>&lt;P&gt;It is look like after getting var loopids = hatch.GetAssociatedObjectIds(); you have to check ownerID of each ObjectId and if it is not equal blktbl[BlockTableRecord.ModelSpace] - you have to skip it in loop of dot.MoveBelow(...)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 15:13:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130295#M17304</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2021-03-04T15:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: eNotInBlock error when running DisplayOrder on Hatches and their boundary loops.</title>
      <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130408#M17305</link>
      <description>&lt;P&gt;Taking your input, I wrote code to test if the loop has the same OwnerId as the hatch.&amp;nbsp; You were correct, when they don't match, then it errors.&amp;nbsp; If you can explain, I would appreciate it, "How can they have a different OwnerId?"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try within the transaction to set the loop.OwnerId = hatch.OwnerId, which did work, but it still throws the error.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 15:41:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130408#M17305</guid>
      <dc:creator>dennis</dc:creator>
      <dc:date>2021-03-04T15:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: eNotInBlock error when running DisplayOrder on Hatches and their boundary loops.</title>
      <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130439#M17306</link>
      <description>&lt;P&gt;Maybe this objects are not in ModelSpace but in other BlockTableRecord(s)? You have to check owner of it.&lt;/P&gt;
&lt;P&gt;It is impossible to set property OwnerId but there is a method BlockTableRecord.AssumeOwnershipOf&amp;nbsp; which help to change owner of entities.&lt;/P&gt;
&lt;P&gt;Sample of using this method: &lt;A href="https://forums.autodesk.com/t5/net/selecting-all-entities-and-drawing-and-moving-them-from/m-p/9304101#M64876" target="_blank"&gt;https://forums.autodesk.com/t5/net/selecting-all-entities-and-drawing-and-moving-them-from/m-p/9304101#M64876&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 16:01:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130439#M17306</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2021-03-04T16:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: eNotInBlock error when running DisplayOrder on Hatches and their boundary loops.</title>
      <link>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130495#M17307</link>
      <description>&lt;P&gt;Thanks for the help.&amp;nbsp; The Assume doesn't relieve the problem, but now I know what to check so as to avoid the catch.&amp;nbsp; In the long run, it doesn't seem to be causing any downstream problems.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 16:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enotinblock-error-when-running-displayorder-on-hatches-and-their/m-p/10130495#M17307</guid>
      <dc:creator>dennis</dc:creator>
      <dc:date>2021-03-04T16:02:55Z</dc:date>
    </item>
  </channel>
</rss>

