<?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 : Code++ in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5169011#M43656</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By looking in my code, does anyone knows why, while adding "Circle" in model space, it returns null specifics properties!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jul 2014 09:47:13 GMT</pubDate>
    <dc:creator>MGOMKD</dc:creator>
    <dc:date>2014-07-23T09:47:13Z</dc:date>
    <item>
      <title>AutoCAD crashes by using ObjectAppended only with some entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5087934#M43650</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to re-encode my plug-in lighter, in order to optimize tasks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I would like to store dynamically, in an ArrayList or else, entities properties (ID, Layer, Bounds...etc.) by using reactors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works! but not with every entity! For instance AutoCAD crashes when I create a CIRCLE while ObjectAppended is invoking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a simply code to resume:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput

Public Class Class1

    Friend acDoc As Document = Application.DocumentManager.MdiActiveDocument
    Friend acCurDb As Database = acDoc.Database
    Friend ed As Editor = acDoc.Editor

    &amp;lt;CommandMethod("Test")&amp;gt; _
    Public Sub Test()

        AddHandler acCurDb.ObjectAppended, AddressOf MyDelegate

    End Sub

    Public Sub MyDelegate(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.DatabaseServices.ObjectEventArgs)

        On Error Resume Next

        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

            Dim acblktbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
            Dim acblkTblRec As BlockTableRecord = acTrans.GetObject(acblktbl(BlockTableRecord.ModelSpace), OpenMode.ForRead)

            For Each acObjId As ObjectId In acblkTblRec

                If acObjId = e.DBObject.ObjectId Then

                    Dim MyEnt As Entity = acTrans.GetObject(acObjId, OpenMode.ForRead)
                    Dim message As String = MyEnt.GetRXClass.DxfName.ToString &amp;amp; vbLf

                    Select Case MyEnt.GetRXClass.DxfName

                        Case Is = "LWPOLYLINE"
                            Dim Mypolyline As Polyline = CType(MyEnt, Entity)
                            message += "Area= " &amp;amp; Mypolyline.Area.ToString &amp;amp; vbLf
                            message += "Layer= " &amp;amp; Mypolyline.Layer.ToString &amp;amp; vbLf
                            message += "Min point= " &amp;amp; Mypolyline.Bounds.Value.MinPoint.ToString &amp;amp; vbLf
                            message += "Max point= " &amp;amp; Mypolyline.Bounds.Value.MaxPoint.ToString &amp;amp; vbLf

                        Case Is = "CIRCLE"
                            Dim Mycircle As Circle = CType(MyEnt, Circle)
                            message += "Area= " &amp;amp; Mycircle.Area.ToString &amp;amp; vbLf
                            message += "Calque= " &amp;amp; Mycircle.Layer.ToString &amp;amp; vbLf
                            message += "Radius= " &amp;amp; Mycircle.Radius.ToString &amp;amp; vbLf

                    End Select

                    MsgBox(message)

                End If

            Next

        End Using
    End Sub

End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;What can I do to solve that!?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 14:19:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5087934#M43650</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2014-06-11T14:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD crashes by using ObjectAppended only with some entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089112#M43651</link>
      <description>&lt;P&gt;I would imagine that this post would get more traction over in the customizations forums.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:38:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089112#M43651</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-11T18:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD crashes by using ObjectAppended only with some entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089206#M43652</link>
      <description>&lt;P&gt;Sure! But how could I put it in the right section, I mean .NET section!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 19:04:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089206#M43652</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2014-06-11T19:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD crashes by using ObjectAppended only with some entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089352#M43653</link>
      <description>&lt;P&gt;Use the RIC (Report Inappropriate Content) selection on the left and ask and admin to move it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;DJ&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 19:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5089352#M43653</guid>
      <dc:creator>drjohn</dc:creator>
      <dc:date>2014-06-11T19:41:30Z</dc:date>
    </item>
    <item>
      <title>Code++</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5096944#M43655</link>
      <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I solved the problem by adding this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;acTrans.Commit&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AutoCAD&lt;/SPAN&gt; &lt;SPAN&gt;now&lt;/SPAN&gt; &lt;SPAN&gt;no longer crashes&lt;/SPAN&gt; &lt;SPAN&gt;but another&lt;/SPAN&gt; &lt;SPAN&gt;problem&lt;/SPAN&gt; &lt;SPAN&gt;occurs when&lt;/SPAN&gt; &lt;SPAN&gt;adding&lt;/SPAN&gt; &lt;SPAN&gt;circles.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Specific&lt;/SPAN&gt; &lt;SPAN&gt;properties (like center, circumference, radius, diameter) are initialized&lt;/SPAN&gt; &lt;SPAN&gt;to 0, while&lt;/SPAN&gt; &lt;SPAN&gt;those of other entities&lt;/SPAN&gt; &lt;SPAN&gt;are&lt;/SPAN&gt; well &lt;SPAN&gt;notified.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Here is&lt;/SPAN&gt; &lt;SPAN&gt;the code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput

Public Class Class1

    Friend acDoc As Document = Application.DocumentManager.MdiActiveDocument
    Friend acCurDb As Database = acDoc.Database
    Friend ed As Editor = acDoc.Editor

    &amp;lt;CommandMethod("Test")&amp;gt; _
    Public Sub Test()
        AddHandler acCurDb.ObjectAppended, AddressOf MyDelegate
    End Sub

    Public Sub MyDelegate(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.DatabaseServices.ObjectEventArgs)

        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

            Dim acblktbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
            Dim acblkTblRec As BlockTableRecord = acTrans.GetObject(acblktbl(BlockTableRecord.ModelSpace), OpenMode.ForRead)

            For Each acObjId As ObjectId In acblkTblRec

                If acObjId = e.DBObject.ObjectId Then

                    Dim MyEnt As Entity = acTrans.GetObject(acObjId, OpenMode.ForRead)
                    Dim message As String = "Object: " &amp;amp; MyEnt.GetRXClass.DxfName.ToString &amp;amp; vbLf
                    message += "Layer= " &amp;amp; MyEnt.Layer.ToString &amp;amp; vbLf
                    message += "Color Index= " &amp;amp; MyEnt.ColorIndex.ToString &amp;amp; vbLf

                    Select Case MyEnt.GetRXClass.DxfName
                        Case Is = "ARC"
                            Dim Myarc As Arc = CType(MyEnt, Arc)
                            message += "Bounds Min point= " &amp;amp; Myarc.Bounds.Value.MinPoint.ToString &amp;amp; vbLf
                            message += "Bounds Max point= " &amp;amp; Myarc.Bounds.Value.MaxPoint.ToString &amp;amp; vbLf
                            message += "Center= " &amp;amp; Myarc.Center.ToString &amp;amp; vbLf
                            message += "Radius= " &amp;amp; Myarc.Radius.ToString

                        Case Is = "CIRCLE"
                            Dim Mycircle As Circle = CType(MyEnt, Circle)
                            message += "Bounds Min point= " &amp;amp; Mycircle.Bounds.Value.MinPoint.ToString &amp;amp; vbLf
                            message += "Bounds Max point= " &amp;amp; Mycircle.Bounds.Value.MaxPoint.ToString &amp;amp; vbLf
                            message += "Center= " &amp;amp; Mycircle.Center.ToString &amp;amp; vbLf
                            message += "Radius= " &amp;amp; Mycircle.Radius.ToString &amp;amp; vbLf
                            message += "Diameter= " &amp;amp; Mycircle.Diameter.ToString &amp;amp; vbLf
                            message += "Circumference= " &amp;amp; Mycircle.Circumference

                        Case Is = "LWPOLYLINE"
                            Dim Mypolyline As Polyline = CType(MyEnt, Polyline)
                            message += "Bounds Min point= " &amp;amp; Mypolyline.Bounds.Value.MinPoint.ToString &amp;amp; vbLf
                            message += "Bounds Max point= " &amp;amp; Mypolyline.Bounds.Value.MaxPoint.ToString &amp;amp; vbLf
                            message += "Area= " &amp;amp; Mypolyline.Area.ToString &amp;amp; vbLf
                            message += "Length= " &amp;amp; Mypolyline.Length.ToString

                        Case Is = "XLINE"
                            Dim Myxline As Xline = TryCast(MyEnt, Xline)
                            message += "Handle= " &amp;amp; Myxline.Handle.ToString

                    End Select

                    MsgBox(message)

                End If

            Next

            acTrans.Commit()

        End Using

    End Sub

End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's wrong with my code?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 09:24:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5096944#M43655</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2014-06-16T09:24:58Z</dc:date>
    </item>
    <item>
      <title>Re : Code++</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5169011#M43656</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By looking in my code, does anyone knows why, while adding "Circle" in model space, it returns null specifics properties!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 09:47:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-crashes-by-using-objectappended-only-with-some-entities/m-p/5169011#M43656</guid>
      <dc:creator>MGOMKD</dc:creator>
      <dc:date>2014-07-23T09:47:13Z</dc:date>
    </item>
  </channel>
</rss>

