<?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 Set document variable (in memory) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11743602#M10048</link>
    <description>&lt;P&gt;Hi, I have a number of files where the variable VISRETAIN as to be updated.&lt;/P&gt;&lt;P&gt;I would like to do so by loading the document in memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim myDB As New Database(False, True)&lt;BR /&gt;myDB.ReadDwgFile(file, FileOpenMode.OpenForReadAndAllShare, False, "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to set drawing variables from the database? And if I must get a document object, is there a way to load a document in memory?&lt;/P&gt;&lt;P&gt;(I found that I can set variables within a document as follows:&amp;nbsp;&lt;SPAN&gt;acadDocument.Setvariable("DIMASZ",1.5).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2023 19:39:04 GMT</pubDate>
    <dc:creator>ym.56789</dc:creator>
    <dc:date>2023-02-09T19:39:04Z</dc:date>
    <item>
      <title>Set document variable (in memory)</title>
      <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11743602#M10048</link>
      <description>&lt;P&gt;Hi, I have a number of files where the variable VISRETAIN as to be updated.&lt;/P&gt;&lt;P&gt;I would like to do so by loading the document in memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim myDB As New Database(False, True)&lt;BR /&gt;myDB.ReadDwgFile(file, FileOpenMode.OpenForReadAndAllShare, False, "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to set drawing variables from the database? And if I must get a document object, is there a way to load a document in memory?&lt;/P&gt;&lt;P&gt;(I found that I can set variables within a document as follows:&amp;nbsp;&lt;SPAN&gt;acadDocument.Setvariable("DIMASZ",1.5).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 19:39:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11743602#M10048</guid>
      <dc:creator>ym.56789</dc:creator>
      <dc:date>2023-02-09T19:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set document variable (in memory)</title>
      <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11743766#M10049</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Database class exposes a &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_Database_Visretain" target="_blank" rel="noopener"&gt;Visretain property&lt;/A&gt;. you can simply do:&lt;/P&gt;
&lt;P&gt;myDB.VisRetain = 0&lt;/P&gt;
&lt;P&gt;or:&lt;/P&gt;
&lt;P&gt;myDB.VisRetain = 1&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 20:46:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11743766#M10049</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-09T20:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Set document variable (in memory)</title>
      <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745482#M10050</link>
      <description>&lt;P&gt;Thank you very much for your answer - I see I can access all other document variables in this manner as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you perhaps help me further though? I don't seem to know how to save the variable: (here's my code)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim myDB As New Database(False, True)&lt;BR /&gt;myDB.ReadDwgFile(file, FileOpenMode.OpenForReadAndWriteNoShare, False, "")&lt;BR /&gt;Using myTrans As Transaction = myDB.TransactionManager.StartTransaction&lt;BR /&gt;myDB.Visretain = 0&lt;BR /&gt;myTrans.Commit()&lt;BR /&gt;End Using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code runs with no errors, but when I open up the file VISRETAIN is still at 1. (Additionally in the file properties the date modified property shows the file was not modified recently.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 14:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745482#M10050</guid>
      <dc:creator>ym.56789</dc:creator>
      <dc:date>2023-02-10T14:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set document variable (in memory)</title>
      <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745695#M10051</link>
      <description>&lt;P&gt;You have to save your database before disposing it.&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Using myDB As New Database(False, True)
    myDB.ReadDwgFile(file, FileOpenMode.OpenForReadAndWriteNoShare, False, "")
    Using myTrans As Transaction = myDB.TransactionManager.StartTransaction
        myDB.Visretain = 0
        myTrans.Commit()
    End Using
    myDB.SaveAs(file, DwgVersion.Current)
End Using&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Feb 2023 15:48:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745695#M10051</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-10T15:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set document variable (in memory)</title>
      <link>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745788#M10052</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 16:13:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/set-document-variable-in-memory/m-p/11745788#M10052</guid>
      <dc:creator>ym.56789</dc:creator>
      <dc:date>2023-02-10T16:13:55Z</dc:date>
    </item>
  </channel>
</rss>

