<?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 A simple overrule snaps which either doesn't work or make crash in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246714#M58140</link>
    <description>&lt;P&gt;Hello again. I hope this time somebody help me.&lt;/P&gt;
&lt;P&gt;I tried to simplified everything .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Attached please find a&amp;nbsp; a drawing&amp;nbsp; for use with code. command is&amp;nbsp; "onoff" to make over rule activate.&lt;/P&gt;
&lt;P&gt;Problem is snaps doesn't like to work at all .&amp;nbsp; I try to put a dimension line at end of overrule lines and either it crash or doen't like to grip the end point of line. And below is code.&amp;nbsp; it is 2012 .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Janet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Imports System.Math
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.GraphicsInterface
Public Class MyOverRuleClass
    Public Shared MyXdataTablename = "My_Data"
    Public Shared BlockshapeOverrule As Block_XdataDrawOverrule
    Public Shared BlockOsnapOverrule As Block_XdataOsnapOverrule
    &amp;lt;CommandMethod("onoff")&amp;gt; _
    Public Shared Sub StartMyOverrule()
        If BlockshapeOverrule Is Nothing Then
            BlockshapeOverrule = New Block_XdataDrawOverrule
            BlockOsnapOverrule = New Block_XdataOsnapOverrule
            Overrule.AddOverrule(RXClass.GetClass(GetType(BlockReference)), BlockshapeOverrule, True)
            Overrule.AddOverrule(RXClass.GetClass(GetType(BlockReference)), BlockOsnapOverrule, True)
            BlockshapeOverrule.SetXDataFilter(MyXdataTablename)
            BlockOsnapOverrule.SetXDataFilter(MyXdataTablename)
            Application.DocumentManager.MdiActiveDocument.Editor.Regen()
        Else
            Overrule.RemoveOverrule(RXClass.GetClass(GetType(BlockReference)), BlockshapeOverrule)
            BlockshapeOverrule.Dispose()
            BlockshapeOverrule = Nothing
            Application.DocumentManager.MdiActiveDocument.Editor.Regen()
        End If
    End Sub
End Class
Public Class Block_Dimension
    Inherits DrawableOverrule
    Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
        Return False
    End Function
End Class
Public Class Block_XdataDrawOverrule
    Inherits DrawableOverrule
    Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
        Return False
    End Function
    Public Overloads Overrides Sub ViewportDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, _
                                                ByVal vd As Autodesk.AutoCAD.GraphicsInterface.ViewportDraw)

        Dim myDynamicBlock As BlockReference = drawable

        Dim BlockOffset1 As New BlockOffset
        Dim ListEnts As List(Of Entity) = BlockOffset1.Offset(myDynamicBlock)
        For Each Ent As Entity In ListEnts
            Ent.ViewportDraw(vd)
            Ent.Dispose()
        Next
        MyBase.ViewportDraw(drawable, vd)
    End Sub
End Class
Public Class Block_XdataOsnapOverrule
    Inherits OsnapOverrule
    Public Overrides Sub GetObjectSnapPoints(ByVal e As Entity, _
                                              ByVal snapMode As ObjectSnapModes, _
                                              ByVal gsSelectionMark As System.IntPtr, _
                                              ByVal pickPoint As Point3d, _
                                              ByVal lastPoint As Point3d, _
                                              ByVal viewTransform As Matrix3d, _
                                              ByVal snapPoints As Point3dCollection, _
                                              ByVal geometryIds As IntegerCollection)

        Dim myDynamicBlock As BlockReference = TryCast(e, BlockReference)
        Dim BlockOffset1 As New BlockOffset
        Dim ListEnts As List(Of Entity) = BlockOffset1.Offset(myDynamicBlock)
        For Each SubEnt As Entity In ListEnts
            SubEnt.GetObjectSnapPoints(snapMode, gsSelectionMark, pickPoint, lastPoint, viewTransform, snapPoints, geometryIds)
            SubEnt.Dispose()
        Next
        MyBase.GetObjectSnapPoints(e, snapMode, gsSelectionMark, pickPoint, lastPoint, viewTransform, snapPoints, geometryIds)
    End Sub
End Class

Public Class BlockOffset
    Function Offset(ByVal MyBlock As BlockReference) As List(Of Entity)
        Offset = New List(Of Entity)
        Dim List_Entities As List(Of Entity) = GetBlockEntities(MyBlock)
        Dim line1 As New Line
        line1 = TryCast(List_Entities(0), Line)
        Dim MyPolyLine1 As Autodesk.AutoCAD.DatabaseServices.Polyline = New Autodesk.AutoCAD.DatabaseServices.Polyline
        Dim MyPt1 As Point3d = PolarPoint(line1.StartPoint, line1.Angle + (0.5 * PI), 300)
        Dim MyPt2 As Point3d = PolarPoint(line1.StartPoint, line1.Angle - (0.5 * PI), 300)
        MyPolyLine1.AddVertexAt(0, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
        MyPolyLine1.AddVertexAt(1, New Point2d(MyPt2.X, MyPt2.Y), 0, 0, 0)
        Offset.Add(TryCast(MyPolyLine1, Entity)) ' perpendicular line to block direction at beginning

        MyPolyLine1 = New Autodesk.AutoCAD.DatabaseServices.Polyline
        MyPt1 = PolarPoint(line1.StartPoint, line1.Angle, 200)
        MyPolyLine1.AddVertexAt(0, New Point2d(line1.StartPoint.X, line1.StartPoint.Y), 0, 0, 0)
        MyPolyLine1.AddVertexAt(1, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
        MyPolyLine1.SetEndWidthAt(0, 100)
        Offset.Add(TryCast(MyPolyLine1, Entity)) '  arrow at begining
    End Function
    Shared Function GetBlockEntities(ByVal BR As BlockReference) As List(Of Entity)
        GetBlockEntities = New List(Of Entity)
        Dim acDBObjColl As DBObjectCollection = New DBObjectCollection()
        BR.Explode(acDBObjColl)
        For Each Ent As DBObject In acDBObjColl
            If TypeOf Ent Is Line Then
                Dim MyEntity As Entity = TryCast(Ent, Entity).Clone
                GetBlockEntities.Add(MyEntity)
            End If
        Next
    End Function
    Private Function PolarPoint(ByVal basepoint As Point3d, ByVal angle As Double, ByVal distance As Double) As Point3d
        Return New Point3d(basepoint.X + (distance * Cos(angle)), basepoint.Y + (distance * Sin(angle)), basepoint.Z)
    End Function
End Class&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Edited by&lt;BR /&gt;Discussion_Admin&lt;/P&gt;</description>
    <pubDate>Thu, 01 Dec 2011 23:16:29 GMT</pubDate>
    <dc:creator>JanetDavidson</dc:creator>
    <dc:date>2011-12-01T23:16:29Z</dc:date>
    <item>
      <title>A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246714#M58140</link>
      <description>&lt;P&gt;Hello again. I hope this time somebody help me.&lt;/P&gt;
&lt;P&gt;I tried to simplified everything .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Attached please find a&amp;nbsp; a drawing&amp;nbsp; for use with code. command is&amp;nbsp; "onoff" to make over rule activate.&lt;/P&gt;
&lt;P&gt;Problem is snaps doesn't like to work at all .&amp;nbsp; I try to put a dimension line at end of overrule lines and either it crash or doen't like to grip the end point of line. And below is code.&amp;nbsp; it is 2012 .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Janet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Imports System.Math
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.GraphicsInterface
Public Class MyOverRuleClass
    Public Shared MyXdataTablename = "My_Data"
    Public Shared BlockshapeOverrule As Block_XdataDrawOverrule
    Public Shared BlockOsnapOverrule As Block_XdataOsnapOverrule
    &amp;lt;CommandMethod("onoff")&amp;gt; _
    Public Shared Sub StartMyOverrule()
        If BlockshapeOverrule Is Nothing Then
            BlockshapeOverrule = New Block_XdataDrawOverrule
            BlockOsnapOverrule = New Block_XdataOsnapOverrule
            Overrule.AddOverrule(RXClass.GetClass(GetType(BlockReference)), BlockshapeOverrule, True)
            Overrule.AddOverrule(RXClass.GetClass(GetType(BlockReference)), BlockOsnapOverrule, True)
            BlockshapeOverrule.SetXDataFilter(MyXdataTablename)
            BlockOsnapOverrule.SetXDataFilter(MyXdataTablename)
            Application.DocumentManager.MdiActiveDocument.Editor.Regen()
        Else
            Overrule.RemoveOverrule(RXClass.GetClass(GetType(BlockReference)), BlockshapeOverrule)
            BlockshapeOverrule.Dispose()
            BlockshapeOverrule = Nothing
            Application.DocumentManager.MdiActiveDocument.Editor.Regen()
        End If
    End Sub
End Class
Public Class Block_Dimension
    Inherits DrawableOverrule
    Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
        Return False
    End Function
End Class
Public Class Block_XdataDrawOverrule
    Inherits DrawableOverrule
    Public Overrides Function WorldDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, ByVal wd As Autodesk.AutoCAD.GraphicsInterface.WorldDraw) As Boolean
        Return False
    End Function
    Public Overloads Overrides Sub ViewportDraw(ByVal drawable As Autodesk.AutoCAD.GraphicsInterface.Drawable, _
                                                ByVal vd As Autodesk.AutoCAD.GraphicsInterface.ViewportDraw)

        Dim myDynamicBlock As BlockReference = drawable

        Dim BlockOffset1 As New BlockOffset
        Dim ListEnts As List(Of Entity) = BlockOffset1.Offset(myDynamicBlock)
        For Each Ent As Entity In ListEnts
            Ent.ViewportDraw(vd)
            Ent.Dispose()
        Next
        MyBase.ViewportDraw(drawable, vd)
    End Sub
End Class
Public Class Block_XdataOsnapOverrule
    Inherits OsnapOverrule
    Public Overrides Sub GetObjectSnapPoints(ByVal e As Entity, _
                                              ByVal snapMode As ObjectSnapModes, _
                                              ByVal gsSelectionMark As System.IntPtr, _
                                              ByVal pickPoint As Point3d, _
                                              ByVal lastPoint As Point3d, _
                                              ByVal viewTransform As Matrix3d, _
                                              ByVal snapPoints As Point3dCollection, _
                                              ByVal geometryIds As IntegerCollection)

        Dim myDynamicBlock As BlockReference = TryCast(e, BlockReference)
        Dim BlockOffset1 As New BlockOffset
        Dim ListEnts As List(Of Entity) = BlockOffset1.Offset(myDynamicBlock)
        For Each SubEnt As Entity In ListEnts
            SubEnt.GetObjectSnapPoints(snapMode, gsSelectionMark, pickPoint, lastPoint, viewTransform, snapPoints, geometryIds)
            SubEnt.Dispose()
        Next
        MyBase.GetObjectSnapPoints(e, snapMode, gsSelectionMark, pickPoint, lastPoint, viewTransform, snapPoints, geometryIds)
    End Sub
End Class

Public Class BlockOffset
    Function Offset(ByVal MyBlock As BlockReference) As List(Of Entity)
        Offset = New List(Of Entity)
        Dim List_Entities As List(Of Entity) = GetBlockEntities(MyBlock)
        Dim line1 As New Line
        line1 = TryCast(List_Entities(0), Line)
        Dim MyPolyLine1 As Autodesk.AutoCAD.DatabaseServices.Polyline = New Autodesk.AutoCAD.DatabaseServices.Polyline
        Dim MyPt1 As Point3d = PolarPoint(line1.StartPoint, line1.Angle + (0.5 * PI), 300)
        Dim MyPt2 As Point3d = PolarPoint(line1.StartPoint, line1.Angle - (0.5 * PI), 300)
        MyPolyLine1.AddVertexAt(0, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
        MyPolyLine1.AddVertexAt(1, New Point2d(MyPt2.X, MyPt2.Y), 0, 0, 0)
        Offset.Add(TryCast(MyPolyLine1, Entity)) ' perpendicular line to block direction at beginning

        MyPolyLine1 = New Autodesk.AutoCAD.DatabaseServices.Polyline
        MyPt1 = PolarPoint(line1.StartPoint, line1.Angle, 200)
        MyPolyLine1.AddVertexAt(0, New Point2d(line1.StartPoint.X, line1.StartPoint.Y), 0, 0, 0)
        MyPolyLine1.AddVertexAt(1, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
        MyPolyLine1.SetEndWidthAt(0, 100)
        Offset.Add(TryCast(MyPolyLine1, Entity)) '  arrow at begining
    End Function
    Shared Function GetBlockEntities(ByVal BR As BlockReference) As List(Of Entity)
        GetBlockEntities = New List(Of Entity)
        Dim acDBObjColl As DBObjectCollection = New DBObjectCollection()
        BR.Explode(acDBObjColl)
        For Each Ent As DBObject In acDBObjColl
            If TypeOf Ent Is Line Then
                Dim MyEntity As Entity = TryCast(Ent, Entity).Clone
                GetBlockEntities.Add(MyEntity)
            End If
        Next
    End Function
    Private Function PolarPoint(ByVal basepoint As Point3d, ByVal angle As Double, ByVal distance As Double) As Point3d
        Return New Point3d(basepoint.X + (distance * Cos(angle)), basepoint.Y + (distance * Sin(angle)), basepoint.Z)
    End Function
End Class&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Edited by&lt;BR /&gt;Discussion_Admin&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 23:16:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246714#M58140</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2011-12-01T23:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246776#M58141</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first I see this line is missing when you turn off your overrule-handling.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Overrule.RemoveOverrule(RXClass.GetClass(GetType(BlockReference)), BlockOsnapOverrule) 'appended&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the rest: I don't see anything except dynamic block (within the zoomed area, outside of screen are a lot more entities) and what should I do to see your problem? I also don't know what this overrule should do (and I don't like to study your code, it's more efficient if you describe what to do to come to your problem &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;</description>
      <pubDate>Thu, 01 Dec 2011 19:49:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246776#M58141</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-01T19:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246844#M58142</link>
      <description>&lt;P&gt;Alfred,&lt;/P&gt;&lt;P&gt;Thanks for Reply, I added your suggestion line .&lt;/P&gt;&lt;P&gt;My intetion is zoomed area ignore the rest , . I added a picture below to show you&amp;nbsp;what it does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 20:28:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246844#M58142</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2011-12-01T20:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246966#M58143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx for your screenshot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I load your app and start command ONOFF I get a lot of these messages:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Forgot to call Dispose? (Autodesk.AutoCAD.DatabaseServices.Polyline): DisposableWrapper&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Forgot to call Dispose? (Autodesk.AutoCAD.DatabaseServices.Line): DisposableWrapper&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;That could be avoided and for more stability it is recommended to use &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;.Dispose&lt;/FONT&gt; on such objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next problem is that I get a&amp;nbsp;System.ArgumentOutOfRangeException (plus a Framework error dialog, giving the information that this line:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;line1 = TryCast(List_Entities(0), Line)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;creates the exception, could be&lt;/P&gt;&lt;P&gt;a) the parameter for the &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;GetBlockEntities&lt;/FONT&gt;-call (variable &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;myBlock&lt;/FONT&gt;) is nothing&lt;/P&gt;&lt;P&gt;b) the BlockTableRecord does not contain LINES&lt;/P&gt;&lt;P&gt;c) or (at least) your function &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;GetBlockEntities&lt;/FONT&gt; does not return values in any case or in the right way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is what I got know with Civil3D2012x64 under Win7x64 (all German).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck, - alfred -&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 21:46:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246966#M58143</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-01T21:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246996#M58144</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok, I have tested now with a small part of your drawing after changing the code to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;&lt;PRE&gt;   Function Offset(ByVal MyBlock As BlockReference) As List(Of Entity)
      Offset = New List(Of Entity)
      Dim List_Entities As List(Of Entity) = GetBlockEntities(MyBlock)
     &lt;EM&gt;&lt;FONT color="#FF0000"&gt; If List_Entities.Count &amp;gt; 0 Then&lt;/FONT&gt;&lt;/EM&gt;
         Dim line1 As New Line
         line1 = TryCast(List_Entities(0), Line)
         Dim MyPolyLine1 As Autodesk.AutoCAD.DatabaseServices.Polyline = New Autodesk.AutoCAD.DatabaseServices.Polyline
         Dim MyPt1 As Point3d = PolarPoint(line1.StartPoint, line1.Angle + (0.5 * PI), 300)
         Dim MyPt2 As Point3d = PolarPoint(line1.StartPoint, line1.Angle - (0.5 * PI), 300)
         MyPolyLine1.AddVertexAt(0, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
         MyPolyLine1.AddVertexAt(1, New Point2d(MyPt2.X, MyPt2.Y), 0, 0, 0)
         Offset.Add(TryCast(MyPolyLine1, Entity)) ' perpendicular line to block direction at beginning

         MyPolyLine1 = New Autodesk.AutoCAD.DatabaseServices.Polyline
         MyPt1 = PolarPoint(line1.StartPoint, line1.Angle, 200)
         MyPolyLine1.AddVertexAt(0, New Point2d(line1.StartPoint.X, line1.StartPoint.Y), 0, 0, 0)
         MyPolyLine1.AddVertexAt(1, New Point2d(MyPt1.X, MyPt1.Y), 0, 0, 0)
         MyPolyLine1.SetEndWidthAt(0, 100)
         Offset.Add(TryCast(MyPolyLine1, Entity)) '  arrow at begining
      &lt;EM&gt;&lt;FONT color="#FF0000"&gt;End If&lt;/FONT&gt;&lt;/EM&gt;
   End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I added the "if ....end if" in this snippet and for short test's it seems to work, no exception, no crash, but very short test!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2011 21:54:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3246996#M58144</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-01T21:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: A simple overrule snaps which either doesn't work or make crash</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3247118#M58145</link>
      <description>&lt;P&gt;Thank you Alfred, Really appreciate your kindness.&lt;/P&gt;&lt;P&gt;I applied you suggestion . &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt; If List_Entities.Count &amp;gt; 0 Then&lt;/FONT&gt;&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;But Still it crashes &amp;nbsp;when I try to put a dimension like the one &amp;nbsp;shown on the &amp;nbsp;picture attached .&lt;/P&gt;&lt;P&gt;The one with attribute &amp;nbsp;and &amp;nbsp; EndPoint sanp is on. &amp;nbsp;Funny thing is If I try to draw a line and snaps to that point, it works fine just dimesnion doesn't &amp;nbsp;work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know is this because of dispose? Still I didn't apply your suggestion regard with dispose &amp;nbsp;because the other block which doens't have attribute is fine .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Besides I don't know where the dispose is necessary . You are right . most of the time I get unexpected crashed every 2 hours and that could be becuase of that . But I don't really know where and at which line I have to do it ?&lt;/P&gt;&lt;P&gt;Thanks again Al.&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;</description>
      <pubDate>Thu, 01 Dec 2011 23:25:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-simple-overrule-snaps-which-either-doesn-t-work-or-make-crash/m-p/3247118#M58145</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2011-12-01T23:25:39Z</dc:date>
    </item>
  </channel>
</rss>

