<?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: overrule is really confusing .... in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3587962#M53812</link>
    <description>&lt;P&gt;Mine is working great now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the important bit of Stephens code that you are still missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Overrides Function SetAttributes(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal traits As Autodesk.AutoCAD.GraphicsInterface.DrawableTraits) As Integer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim res As Integer = MyBase.SetAttributes(drawable, traits)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'See ARX ref guide entry for "AcGiDrawable:&lt;IMG border="0" title="Smiley Frustrated" src="http://autodesk.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" alt=":smileyfrustrated:" /&gt;etAttributesFlags Enumeration"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Bit 32 indicates entity has attributes. If we unset that bit,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' then overruling blockref with attributes works fine. We do&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' this because we're drawing the attributes ourself.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim test As Integer = res And 32&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If test Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res = res - 32&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return res&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/P&gt;</description>
    <pubDate>Mon, 20 Aug 2012 15:41:23 GMT</pubDate>
    <dc:creator>chiefbraincloud</dc:creator>
    <dc:date>2012-08-20T15:41:23Z</dc:date>
    <item>
      <title>overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3578502#M53810</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have to repost this because people may think, last post was answered, but it wasn't and still I am struggling and need a pro to help me here&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Have a overruled block with attribute in it ,&amp;nbsp;I just&amp;nbsp; registered&amp;nbsp;the attributes in&amp;nbsp; my overrule class.&lt;/P&gt;&lt;P&gt;I need to overule (make it simple) just lines ( let's say make&amp;nbsp;them circles) &amp;nbsp;and don't want to show the attributes neither do the rest of objects in block . But if user double click on overruled block I need to show attribute tag input table (Dialog). And don't want to show other objects in block if any exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below&amp;nbsp;is my code and I thought solution&amp;nbsp;would be &amp;nbsp;easy and I have to REM ( or remove the line )&lt;/P&gt;&lt;P&gt;MyBase.WorldDraw(drawable, Wd).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I do that the block is not selectable and a regen crash the autocad . That was my story and here is the code.&lt;/P&gt;&lt;P&gt;I appreciate any help here. For your convenience a simple &amp;nbsp;block is attached.&lt;/P&gt;&lt;P&gt;Janet&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;PRE&gt;Public Class toverrule
        Inherits Autodesk.AutoCAD.GraphicsInterface.DrawableOverrule
        Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal Wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
            Dim myBlock As BlockReference = CType(drawable, BlockReference)

            If Not myBlock.Database Is Nothing Then

                Dim ListEnts As New List(Of Entity)
                Dim MyDBObjColl As DBObjectCollection = New DBObjectCollection()

                myBlock.Explode(MyDBObjColl)

                Dim myline As New Line

                For Each mydbobj As DBObject In MyDBObjColl
                    If TypeOf mydbobj Is Line Then
                        myline = TryCast(mydbobj, Line)
                        Dim mycircle As New Circle
                        mycircle.Radius = myline.Length
                        mycircle.Center = myline.StartPoint
                        ListEnts.Add(mycircle)
                    ElseIf TypeOf mydbobj Is AttributeDefinition Then
                        Dim mycircle As New Circle
                        mycircle.Radius = myline.Length / 2
                        mycircle.Center = myline.StartPoint
                        ListEnts.Add(mycircle)
                    End If
                Next
                For Each Ent As Entity In ListEnts
                    Ent.WorldDraw(Wd)
                    Ent.Dispose()
                Next
                MyBase.WorldDraw(drawable, Wd)
            End If
            Return True
        End Function
    End Class&lt;/PRE&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;&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>Tue, 14 Aug 2012 19:02:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3578502#M53810</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-08-14T19:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3584934#M53811</link>
      <description>&lt;P&gt;Hi janet,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully the sample code I posted in the other thread on this topic gives you what yuo need to fix your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 23:07:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3584934#M53811</guid>
      <dc:creator>StephenPreston</dc:creator>
      <dc:date>2012-08-16T23:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3587962#M53812</link>
      <description>&lt;P&gt;Mine is working great now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the important bit of Stephens code that you are still missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Overrides Function SetAttributes(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal traits As Autodesk.AutoCAD.GraphicsInterface.DrawableTraits) As Integer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim res As Integer = MyBase.SetAttributes(drawable, traits)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'See ARX ref guide entry for "AcGiDrawable:&lt;IMG border="0" title="Smiley Frustrated" src="http://autodesk.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" alt=":smileyfrustrated:" /&gt;etAttributesFlags Enumeration"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Bit 32 indicates entity has attributes. If we unset that bit,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' then overruling blockref with attributes works fine. We do&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' this because we're drawing the attributes ourself.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim test As Integer = res And 32&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If test Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res = res - 32&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return res&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 15:41:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3587962#M53812</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-08-20T15:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3588110#M53813</link>
      <description>&lt;P&gt;That was great-everything is working now &amp;nbsp;, Are you Tony? hehehehhe.&lt;/P&gt;&lt;P&gt;Thanks chief . The other thread screwed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 17:00:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3588110#M53813</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-08-20T17:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3609084#M53814</link>
      <description>&lt;P&gt;The credit belongs to Stephen Preston.&amp;nbsp; I was already overriding the SetAttributes function in my code, but I did not know that I needed to remove the 32 bit for blocks with attributes.&amp;nbsp; That part came from Stephen, and that is the only part that was missing from my original code, to make it work.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 07:19:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3609084#M53814</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-09-06T07:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3609814#M53815</link>
      <description>&lt;P&gt;Chief I am facing a new problem again with&amp;nbsp; same overrule.&lt;/P&gt;&lt;P&gt;I have osnaps overrule and it works fine. But when I used distannce command and sanps to overrule block with attribute &amp;nbsp;it crashes. everything else works fine while snapping to overrule block but this is something .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mind to take a look at it if you have time? I can make it simple for your convenience .&lt;/P&gt;&lt;P&gt;Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 17:11:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3609814#M53815</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-06T17:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3610204#M53816</link>
      <description>&lt;P&gt;Maybe it'll never happen in your circumstance, but you should at least know that if you use the overrule Stephen posted (or any overrule targeting BlockReference for that matter), in a drawing that contains a table that has blocks containing text inserted into the table's cells, AutoCAD will crash when you save the drawing.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:47:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3610204#M53816</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-06T21:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3610418#M53817</link>
      <description>&lt;P&gt;Hello, DP.&lt;/P&gt;&lt;P&gt;Thanks for all support&lt;/P&gt;&lt;P&gt;I did use&amp;nbsp;SP's &amp;nbsp;Attribute Overrides Function. It solved most of my problems. And I realized Geometry Draw acting goofy.&lt;/P&gt;&lt;P&gt;So&amp;nbsp; I used word draw , even though&amp;nbsp; Geometry draw&amp;nbsp;is &amp;nbsp;faster on regen.&lt;/P&gt;&lt;P&gt;Right now everything works fine except for Autocad Distance command. It crashes.&lt;/P&gt;&lt;P&gt;If you or CB can help me, &amp;nbsp;I would be very grateful. Attached is block drawing file and code. Basically I replaced the lines in block&amp;nbsp; with 2 polylines, the same length.&amp;nbsp;Try to do a Distance between polylines. It crashes the machine.&lt;/P&gt;&lt;P&gt;Hope I can get help from you gentlemen again.&lt;/P&gt;&lt;P&gt;Thanks Janet&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 04:07:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3610418#M53817</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-07T04:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611464#M53818</link>
      <description>&lt;P&gt;Janet, I don't code in VB.NET unfortunately, and can't easily test your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I will tell you, is that overrules are one of the most complicated aspects of AutoCAD .NET programming, and certainly not a good vehicle for an introductory tutorial, so perhaps you've gotten the wrong impression that overrules are relatively-simple to write and debug when in fact, they are a challenge for even highly experienced AutoCAD .NET programmers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;About your code, one major problem I see by just looking at it, is that it calls Explode() on a block reference, and then returns a &lt;EM&gt;&lt;STRONG&gt;subset&lt;/STRONG&gt; &lt;/EM&gt;of the entities produced by Expode(), &lt;EM&gt;but fails to call Dispose() on the entities that aren't returned to the caller&lt;/EM&gt;, which will likely cause AutoCAD to crash at some later point, and may very likely be what's happening to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:15:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611464#M53818</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-07T20:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611498#M53819</link>
      <description>&lt;P&gt;&lt;img id="womansad" class="emoticon emoticon-womansad" src="https://forums.autodesk.com/i/smilies/16x16_woman-sad.png" alt="Woman Sad" title="Woman Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. I thought you are Tony.&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;img id="womansad" class="emoticon emoticon-womansad" src="https://forums.autodesk.com/i/smilies/16x16_woman-sad.png" alt="Woman Sad" title="Woman Sad" /&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;But thanks at least you looked at it. In my original code I disposed all entities and still the same.&lt;/P&gt;&lt;P&gt;Just distance command make this crash.&lt;/P&gt;&lt;P&gt;If I convert it in C# would you please look&amp;nbsp;at it ?&lt;/P&gt;&lt;P&gt;Janet&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:20:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611498#M53819</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-07T20:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611588#M53820</link>
      <description>&lt;P&gt;Yes, I am he.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sure, if you post a .cs file that compiles without errors I'll try it.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 22:47:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611588#M53820</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-07T22:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611994#M53821</link>
      <description>&lt;P&gt;Hello Again DP.&lt;/P&gt;&lt;P&gt;After&amp;nbsp;14 hours struggling I finally converted it to C#. Now behavior is completely different. Before in VB I just had crash&lt;/P&gt;&lt;P&gt;on Distance Command. Now I have crash whenever I snap to block. I really hope and beg for your help Tony.&lt;/P&gt;&lt;P&gt;I know you always have a trick in your sleeve.&lt;/P&gt;&lt;P&gt;&lt;img id="womanwink" class="emoticon emoticon-womanwink" src="https://forums.autodesk.com/i/smilies/16x16_woman-wink.png" alt="Woman Wink" title="Woman Wink" /&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Janet&lt;/P&gt;&lt;P&gt;&amp;nbsp;P.S. I renamed file &amp;nbsp;extension to .txt ,&amp;nbsp;website &amp;nbsp;doens't allow extension .cs to be uploaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2012 05:40:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3611994#M53821</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-09T05:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612004#M53822</link>
      <description>&lt;P&gt;Hi Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before I even look at that code, I would ask that you fix the obvious bug and try it again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The bug I'm referring to is the line shown in red below (I renamed the function from Go_Get_blahblahblah...). In that line of code, you're creating a new Line object, but not doing anything with it, and not disposing it, which will probably crash AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public static bool GetExplodedEnts( BlockReference myBlock, ref List&amp;lt;Entity&amp;gt; ListEnts )
{
   DBObjectCollection MyDBObjColl = new DBObjectCollection();
   {
      myBlock.Explode( MyDBObjColl );
      &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Line Line1 = new Line();&lt;/FONT&gt;&lt;/STRONG&gt;
      foreach( DBObject mydbobj in MyDBObjColl )
      {
         if( mydbobj is Line )
         {
            &lt;STRONG&gt;Line1 = mydbobj as Line;&lt;/STRONG&gt;
            Autodesk.AutoCAD.DatabaseServices.Polyline MyPolyLine1 = new Autodesk.AutoCAD.DatabaseServices.Polyline();
            MyPolyLine1.SetDatabaseDefaults();
            MyPolyLine1.AddVertexAt( 0, new Point2d( Line1.StartPoint.X, Line1.StartPoint.Y ), 0, 200, 200 );
            MyPolyLine1.AddVertexAt( 1, new Point2d( Line1.EndPoint.X + 3000, Line1.EndPoint.Y + 3000 ), 0, 200, 200 );
            MyPolyLine1.Closed = true;
            ListEnts.Add( MyPolyLine1 );
         }
         else
         {
            mydbobj.Dispose();
         }
      }
   }
   return true;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;That bug is almost certain to crash AutoCAD.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2012 07:03:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612004#M53822</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-09T07:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612066#M53824</link>
      <description>&lt;P&gt;Hi Janet - There's a few more problems with the code you posted, and they are also in the original VB code as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, have a look at the documentation for &lt;STRONG&gt;&lt;EM&gt;AcGiDrawable::worldDraw()&lt;/EM&gt;&lt;/STRONG&gt; (In the native ObjectARX docs) and make note of what the return value means. Why does your WorldDraw() return false?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public override bool WorldDraw( Drawable drawable, WorldDraw Wd )
{
   BlockReference myBlock = drawable as BlockReference;
   if( ( myBlock.Database != null ) )
   {
      List&amp;lt;Entity&amp;gt; ListEnts = new List&amp;lt;Entity&amp;gt;();
      if( !GetExplodedEnts( myBlock, ListEnts ) )
      {
         &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;return false;&lt;/FONT&gt;&lt;/STRONG&gt;
      }
      foreach( Entity Ent in ListEnts )
      {
         Ent.WorldDraw( Wd );
         Ent.Dispose();
      }
   }
   // base.WorldDraw(drawable, Wd);
   return true;
}&lt;/PRE&gt;&lt;P&gt;Next, your&amp;nbsp;&lt;EM&gt;Go_Get_Overruled_exploded_entities_from_this_block()&lt;/EM&gt; method misuses Try/Catch, by catching any exception that's raised, and without regards for what the exception is or what caused it, your method simply returns False. That's kind of like saying '&lt;EM&gt;I don't care what went wrong, I just want it to work&lt;/EM&gt;', but it will never work until you find out what went wrong, which that kind of mis-use of Try/Catch prevents. If there's no exception, then that same method always returns True, regardless of whether it added anything to the list or not, which is also not correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, your&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;GetObjectSnapPoints()&lt;/STRONG&gt;&lt;/EM&gt; overload uses Try/Catch with an empty catch block&amp;nbsp;&lt;img id="manmad" class="emoticon emoticon-manmad" src="https://forums.autodesk.com/i/smilies/16x16_man-mad.png" alt="Man Mad" title="Man Mad" /&gt;. That's the same as using &lt;EM&gt;On Error Resume Next&lt;/EM&gt; in VBA, and is something you should &lt;EM&gt;never&lt;/EM&gt; do, because it simply hides exceptions from you, making it nearly impossible to debug your code. When you are writing/testing/debugging code, you can put a statement in an otherwise-empty Catch block that displays the exception that was caught, but you should never use Try/Catch with an empty catch block in production code, without being completely sure what exception will be caught.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, as it stands your code has quite a few problems that you need to fix before I would try to run it,.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2012 12:42:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612066#M53824</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-09T12:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612130#M53825</link>
      <description>&lt;P&gt;Hello&amp;nbsp; DP, I really appreciate all these time you spent for teaching me(us).&amp;nbsp;What you are doing here for us is like a father doing for their kids. I am/was you fan alwasy.&lt;/P&gt;&lt;P&gt;I did what you asked and thanks for tips. I had all those catches in my original code but they never been hit. I just removed them from this sample code to make it shorter. I put them back but they never been catch.&lt;/P&gt;&lt;P&gt;Regard with New LIne. You are winner . I forgot it totally. But still doesn't change anything.&lt;/P&gt;&lt;P&gt;I checked document and this is what it says :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000"&gt;A return value of Adesk::kFalse indicates that the 3D GS must &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;call viewportDraw() in order to obtain the complete geometry &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;and attribute set for this drawable. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Frankly, don't understand it . But I changed it to True as you mentioned . Nothing changed.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;By the way If you want to yell at me . It is OK. I know you yell to make students learn better. I am ready. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;( Reminds me those Chinese KungFu movies when the master kicks&amp;nbsp; student &lt;img id="womanlol" class="emoticon emoticon-womanlol" src="https://forums.autodesk.com/i/smilies/16x16_woman-lol.png" alt="Woman LOL" title="Woman LOL" /&gt;&amp;nbsp;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;So HELP &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Janet.&lt;/FONT&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;</description>
      <pubDate>Sun, 09 Sep 2012 15:08:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612130#M53825</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-09T15:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612192#M53826</link>
      <description>&lt;P&gt;Hi Janet,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only looked quickly but a IntPtr has a method ToInt32().&lt;/P&gt;&lt;P&gt;Not sure you can use Convert.ToInt32(gsSelectionMark) try gsSelectionMark.ToInt32() instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2012 20:50:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612192#M53826</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2012-09-09T20:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612248#M53827</link>
      <description>&lt;P&gt;Jeff,&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;After I&amp;nbsp;applied your advice&amp;nbsp;now it acts like my&amp;nbsp;VB version.&lt;/P&gt;&lt;P&gt;Thanks for your time to look into my problem .Still when&amp;nbsp;I do a distance command it crashes.&lt;/P&gt;&lt;P&gt;Tony is on this as well .We are lucky. Huh!&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2012 01:12:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612248#M53827</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-10T01:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612274#M53829</link>
      <description>&lt;P&gt;Jeff already dropped a hint about what the problem is, but I think it's better for you to learn how to find the problem yourself. So, I'll try to show you how to to do that.&lt;BR /&gt;&lt;BR /&gt;One major problem with developing AutoCAD plugins in .NET is that AutoCAD does not always catch exceptions that are thrown by managed code when the managed code is called from lower-level native APIs, overrules being one such case. So, to find out if AutoCAD is crashing as a result of an exception being raised by your overridden overrule methods, you need to wrap them in a try/catch block, and display a message in the catch block, like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public override void GetObjectSnapPoints( Entity e, ObjectSnapModes snapMode, System.IntPtr gsSelectionMark, 
            Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, 
            IntegerCollection geometryIds, Matrix3d insertionMat )
{
   try
   {
      BlockReference myBlock = e as BlockReference;
      List&amp;lt;Entity&amp;gt; ListEnts = new List&amp;lt;Entity&amp;gt;();
      if( !toverrule.GetExplodedEnts( myBlock, ListEnts ) )
      {
         return;
      }
      foreach( Entity SubEnt in ListEnts )
      {
         SubEnt.GetObjectSnapPoints( snapMode, gsSelectionMark.ToInt32(), pickPoint, lastPoint, viewTransform, snapPoints, geometryIds, insertionMat );
         SubEnt.Dispose();
      }
   }
   catch( System.Exception ex )
   {
      Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage( 
         "\n****** Exception: {0}\n\n\n", ex.ToString() 
      );
   }
}

// The same method, except using the try/catch diagnostics in debug builds only:

public override void GetObjectSnapPoints( Entity e, ObjectSnapModes snapMode, System.IntPtr gsSelectionMark, Point3d pickPoint, 
               Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, 
               IntegerCollection geometryIds, Matrix3d insertionMat )
{
#if DEBUG
   try
   {
#endif
      BlockReference myBlock = e as BlockReference;
      List&amp;lt;Entity&amp;gt; ListEnts = new List&amp;lt;Entity&amp;gt;();
      if( !toverrule.GetExplodedEnts( myBlock, ListEnts ) )
      {
         return;
      }
      foreach( Entity SubEnt in ListEnts )
      {
         SubEnt.GetObjectSnapPoints( snapMode, gsSelectionMark.ToInt32(), pickPoint, lastPoint, viewTransform, snapPoints, geometryIds, insertionMat );
         SubEnt.Dispose();
      }
#if DEBUG
   }
   catch( System.Exception ex )
   {
      Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage( 
            "\n****** Exception: {0}\n\n\n", ex.ToString() 
      );
   }
#endif
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you replace your GetOsnapPoints() override with one of the two shown above, then you will see why your code is crashing. Jeff already suggested the remedy, so I'll leave the rest to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2012 01:54:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612274#M53829</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-10T01:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612344#M53830</link>
      <description>&lt;P&gt;Tony, Thank you again for your time. VB version had only Distance Command problem.&amp;nbsp;That is why I continued this thread and asked for help&amp;nbsp;,when I converted it to C# for your consideration the new bug happened ( because of my low experience in c# , &amp;nbsp;and&amp;nbsp;Jeff remedy put it back to&amp;nbsp; state, which Distance command&amp;nbsp;crashes the program ,now it&amp;nbsp;behaves&amp;nbsp; like VB version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used&amp;nbsp;your suggested Function to see, if it shows the reason it crashes, when we do distance command ,&amp;nbsp;but still it doesn't show what is the problem is . You can try it&amp;nbsp;, use the block,submitted &amp;nbsp;and&amp;nbsp;apply overule and try to make a distance between&amp;nbsp;two &amp;nbsp;new thick polylines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;originally in my code had a [ ref ] for ListEnts, which in your revised version it was removed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Below is what I had originally&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt; (!&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;toverrule&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;.GetExplodedEnts(myBlock,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;ref&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt; ListEnts))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT color="#333300"&gt;and this is your revised one&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt; (!&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;toverrule&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;.GetExplodedEnts(myBlock,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;ref&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt; ListEnts))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;I had to put ref back to make the code work properly&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;Attached please find latest version including &amp;nbsp;your funciton and Jeff remedy. But still crashes on Distance command between two overruled Polylines, and doesn't show what the reason is.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;Thanks &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;&lt;FONT size="1" face="Consolas"&gt;Janet.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&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;</description>
      <pubDate>Mon, 10 Sep 2012 03:57:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612344#M53830</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2012-09-10T03:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: overrule is really confusing ....</title>
      <link>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612436#M53831</link>
      <description>&lt;P&gt;HI Janet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll need to provide some details on your config where the code crashes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, what release of AutoCAD are you using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, what running osnap modes are set, and if you're using immediate osnap, which ones are they for the first and second points?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2012 06:16:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/overrule-is-really-confusing/m-p/3612436#M53831</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-10T06:16:05Z</dc:date>
    </item>
  </channel>
</rss>

