<?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: Read Lisp's property by VB.NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3614800#M53468</link>
    <description>&lt;P&gt;Well, using vlax-ldata-* functions is a grave mistake to start with, going by the fact that in one AutoCAD release, Autodesk provided no way to access data that was put there by a previous release.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest you get your data out of that 'trap' and use XRecords instead, because they don't have that problem, and you can get at them from any API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the mean time, the only way to get this data from managed code is by P/Invoking &lt;EM&gt;&lt;STRONG&gt;acdbEntGet()&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ImpDBObject" is the managed wrapper type that AutoCAD places around database objects that have no other specific managed wrapper type (IOW, object types that are not supported by the managed API). And because there's no specific managed wrapper provided for the custom object that stores the data accessed via vlax-ldata-* functions, it gets this wrapper by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can search this forum for more information on using acdbEntGet() from managed code.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Sep 2012 15:09:39 GMT</pubDate>
    <dc:creator>DiningPhilosopher</dc:creator>
    <dc:date>2012-09-11T15:09:39Z</dc:date>
    <item>
      <title>Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3605716#M53463</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have old Lisp macros, that &lt;SPAN&gt;writes&lt;/SPAN&gt;&amp;nbsp;property to drawing by command (vlax-ldata-put "SpData" cVar cVal). How can I read this &lt;SPAN&gt;property&lt;/SPAN&gt;'s value, using VB.NET ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached file with this &lt;SPAN&gt;property&lt;/SPAN&gt;, its value="TEST"&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2012 10:02:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3605716#M53463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-04T10:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3605918#M53464</link>
      <description>&lt;P&gt;See if this is working for you:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Function GetDictionary(ByVal dictname As String) As DBDictionary
        Dim dict As New DBDictionary
        Dim db As Database = HostApplicationServices.WorkingDatabase
        Using tr As Transaction = db.TransactionManager.StartOpenCloseTransaction
            Dim nod As DBDictionary = TryCast(tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead), DBDictionary)
            If nod Is Nothing Then
                Return Nothing
            End If
            Dim id As ObjectId = ObjectId.Null
            Try
                id = nod.GetAt(dictname)
                dict = TryCast(tr.GetObject(id, OpenMode.ForRead), DBDictionary)
                If dict Is Nothing Then
                    Return Nothing
                Else
                    Return dict
                End If
            Catch ex As Exception
                Return Nothing
            End Try
        End Using

    End Function
    &amp;lt;CommandMethod("ldt")&amp;gt; _
    Public Sub GetLdata()
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument
        Dim ed As Editor = doc.Editor
        Dim db As Database = doc.Database
        Dim spdict As DBDictionary = Getdictionary("SpData")
        If spdict IsNot Nothing Then
            MsgBox("""SpData"" dictionary exist")
        Else
            MsgBox("""SpData"" dictionary does not exist")
            Return
        End If
      
        For Each de As DictionaryEntry In spdict
            ed.WriteMessage("\n{0}\t{1}", de.Key, de.Value)
        Next

    End Sub
    'I've got the returned values like this:
    '    \nFileName\t(2129675160)\nFUSAGE\t(2129675096)\nNAIM\t(2129675088)\nNCONTR\t(212
    '9675128)\nOBOZN\t(2129675080)\nPOSDELTA1\t(2129675144)\nPOSDELTA2\t(2129675152)\
    'nPROV\t(2129675112)\nQUANTNUM\t(2129675168)\nRAZRAB\t(2129675104)\nTCONTR\t(2129
    '675120)\nUTV\t(2129675136)&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>Tue, 04 Sep 2012 12:20:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3605918#M53464</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-04T12:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3607556#M53465</link>
      <description>&lt;P&gt;Thank You!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I so understood that de.Value is an&amp;nbsp;Autodesk.Autocad.DatabaseServices.ImpDBObject's ID? How to get this object's text? I tried do this, but got error "Autodesk.AutoCAD.DatabaseServices.ImpDBObject&amp;nbsp;is unavailable in this context because it's 'Friend' ".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;For Each de As DictionaryEntry In spdict

    Using tr As Transaction = db.TransactionManager.StartTransaction
      
      Dim imp As Autodesk.AutoCAD.DatabaseServices.ImpDBObject = tr.GetObject(de.Value, OpenMode.ForWrite, False, True)
       
      MsgBox(imp.Text)

     End Using

Next&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 09:51:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3607556#M53465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T09:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3608254#M53466</link>
      <description>&lt;P&gt;Try to use OpenMode.ForRead instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using tr As Transaction = db.TransactionManager.StartTransaction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Each de As DictionaryEntry In spdict&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim imp As Autodesk.AutoCAD.DatabaseServices.ImpDBObject = tr.GetObject(de.Value, OpenMode.ForRead, False, True)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(imp.Text)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;End Using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you do open for write, you have first open for write "SpData" dictionary,&lt;/P&gt;&lt;P&gt;then digg deeper inside&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 16:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3608254#M53466</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T16:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3614260#M53467</link>
      <description>&lt;P&gt;if I made so, I &lt;SPAN&gt;received&lt;/SPAN&gt;&amp;nbsp;an error:&lt;/P&gt;&lt;PRE&gt;Dim imp As Autodesk.AutoCAD.DatabaseServices.ImpDBObject 
'Here I got error: "Autodesk.AutoCAD.DatabaseServices.ImpDBObject is 'unavailable in this context because it's 'Friend' "

 &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Trying to made so:&lt;/P&gt;&lt;PRE&gt;Dim obj As DBObject = tr.GetObject(de.Value, OpenMode.ForRead, False, True)

MsgBox(obj.Handle.Value.ToString)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;but &lt;SPAN&gt;received&lt;/SPAN&gt;&amp;nbsp;numbers like 440 ... 435 ... etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This construction:&lt;/P&gt;&lt;PRE&gt;Dim obj As DBObject = tr.GetObject(de.Value, OpenMode.ForRead, False, True)

MsgBox(obj.Handle.ToString)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Returns 1BB ... 1B3 ... etc, but not text string "Test", like in file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make this:&lt;/P&gt;&lt;PRE&gt;Using tr As Transaction = db.TransactionManager.StartTransaction

  For Each de As DictionaryEntry In spdict


      Dim obj As DBObject = tr.GetObject(de.Value, OpenMode.ForRead, False, True)

      Dim txt As DBText = obj


      MsgBox(txt.TextString)

  Next

End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But &lt;SPAN&gt;received&lt;/SPAN&gt;&amp;nbsp;error "it was not possible to give object type&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;Autodesk.AutoCAD.DatabaseServices.ImpDBObject to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;Autodesk.AutoCAD.DatabaseServices.DBText" (sorry, I translate errors from non-english version of Visual Studio)&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;I in perplexity&amp;nbsp;&lt;img id="smileyindifferent" class="emoticon emoticon-smileyindifferent" src="https://forums.autodesk.com/i/smilies/16x16_smiley-indifferent.png" alt="Smiley Indifferent" title="Smiley Indifferent" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2012 12:01:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3614260#M53467</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-11T12:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3614800#M53468</link>
      <description>&lt;P&gt;Well, using vlax-ldata-* functions is a grave mistake to start with, going by the fact that in one AutoCAD release, Autodesk provided no way to access data that was put there by a previous release.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest you get your data out of that 'trap' and use XRecords instead, because they don't have that problem, and you can get at them from any API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the mean time, the only way to get this data from managed code is by P/Invoking &lt;EM&gt;&lt;STRONG&gt;acdbEntGet()&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ImpDBObject" is the managed wrapper type that AutoCAD places around database objects that have no other specific managed wrapper type (IOW, object types that are not supported by the managed API). And because there's no specific managed wrapper provided for the custom object that stores the data accessed via vlax-ldata-* functions, it gets this wrapper by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can search this forum for more information on using acdbEntGet() from managed code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2012 15:09:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3614800#M53468</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-09-11T15:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3618178#M53469</link>
      <description>&lt;P&gt;&lt;SPAN&gt;DinigPhilosopfer,&amp;nbsp;&lt;/SPAN&gt;thanks, I will try&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 06:52:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/3618178#M53469</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-13T06:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/5680545#M53470</link>
      <description>I'm confused by vlax-ldata-*, too.&lt;BR /&gt;Thank you, maybe I can have the problem solved.</description>
      <pubDate>Wed, 17 Jun 2015 07:53:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/5680545#M53470</guid>
      <dc:creator>viper_007</dc:creator>
      <dc:date>2015-06-17T07:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Read Lisp's property by VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/5680569#M53471</link>
      <description>&lt;P&gt;Here is another approach to retrieve the data &amp;amp;colon;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/autocad/2013/01/accessing-ldata-values-from-vba.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2013/01/accessing-ldata-values-from-vba.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 08:15:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/read-lisp-s-property-by-vb-net/m-p/5680569#M53471</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2015-06-17T08:15:09Z</dc:date>
    </item>
  </channel>
</rss>

