<?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: C#: Specific Document for the Document Object in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060268#M21114</link>
    <description>&lt;P&gt;I'm sorry but I'm having trouble understanding how this gives me an advantage over list, is it because I have to break the object statement to place my variable (Drawing Name), so I could control the entire ending like so with a dictionary statement? With my end goal in mind, I do see an advantage in the association capabilities of dictionary, however.&lt;/P&gt;&lt;PRE&gt;Application.DocumentManager.CURRENTDWGVAR.DATABASEVAR;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With your code, how would the syntax look for the above when I am trying to access an open drawing's database from my dictionary to retrieve information?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My end goal is to to get each drawing name, access each drawing database, and retrieve the REV# from the title block attribute. So there would be an association between the drawing name and rev number which I will use throughout my code to accomplish various tasks. I have a similar method in LISP that accomplishes these tasks, however cannot deliver the future functionality I am trying to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to C# so trying to take it one step at a time. I really appreciate the feedback &amp;amp; suggestion.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2019 16:55:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-10-01T16:55:32Z</dc:date>
    <item>
      <title>C#: Specific Document for the Document Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9059971#M21112</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to access the database object of specific drawings. Since I'm creating a list of all of the documents that a CAD user has open (for demonstration purpose only):&lt;/P&gt;&lt;PRE&gt;        public void getDWGList()
        {
            DocumentCollection docs = Application.DocumentManager;

            foreach (Document doc in docs)
            {
                string currentDwg = doc.Name;
                dwgList.Add(currentDwg);
                dwgCount++;&lt;BR /&gt;&lt;BR /&gt;I WILL CALL A FUTURE METHOD HERE WITH THE VARIABLE CURRENTDWG
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to iterate through each drawing and collect some information, which I will store in another list.. How do I specify the document below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Application.DocumentManager.CURRENTDWG-VARIABLE-FROM-ABOVE.Database;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:59:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9059971#M21112</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-01T14:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: C#: Specific Document for the Document Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060080#M21113</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about using a Dictionary&amp;lt;string, Database&amp;gt; instead of a List&amp;lt;string&amp;gt;?&lt;/P&gt;
&lt;P&gt;This way you can retrieve a document database from its name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        public Dictionary&amp;lt;string, Database&amp;gt; GetDocumentsDatabase()
        {
            DocumentCollection docs = Application.DocumentManager;
            var dict = new Dictionary&amp;lt;string, Database&amp;gt;();
            foreach (Document doc in docs)
            {
                dict[doc.Name] = doc.Database;
            }&lt;BR /&gt;            return dict;
        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 15:49:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060080#M21113</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-10-01T15:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: C#: Specific Document for the Document Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060268#M21114</link>
      <description>&lt;P&gt;I'm sorry but I'm having trouble understanding how this gives me an advantage over list, is it because I have to break the object statement to place my variable (Drawing Name), so I could control the entire ending like so with a dictionary statement? With my end goal in mind, I do see an advantage in the association capabilities of dictionary, however.&lt;/P&gt;&lt;PRE&gt;Application.DocumentManager.CURRENTDWGVAR.DATABASEVAR;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With your code, how would the syntax look for the above when I am trying to access an open drawing's database from my dictionary to retrieve information?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My end goal is to to get each drawing name, access each drawing database, and retrieve the REV# from the title block attribute. So there would be an association between the drawing name and rev number which I will use throughout my code to accomplish various tasks. I have a similar method in LISP that accomplishes these tasks, however cannot deliver the future functionality I am trying to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to C# so trying to take it one step at a time. I really appreciate the feedback &amp;amp; suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 16:55:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060268#M21114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-01T16:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: C#: Specific Document for the Document Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060320#M21115</link>
      <description>&lt;P&gt;Sorry I'm not sure to understand what you want to achieve.&lt;/P&gt;
&lt;P&gt;You can access to the databases of the documents directly in your loop:&lt;/P&gt;
&lt;PRE&gt;foreach (Document doc in docs)&lt;BR /&gt;{&lt;BR /&gt;    string currentDwg = doc.Name;&lt;BR /&gt;    Database currentDb = doc.Database;&lt;BR /&gt;    // do what you want here with the document name and document database&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;But as you were storing the document names in an external list, I thaught it would be interesting to store both the name and database of each document in a dictionary so that you can retrieve each document database using its name.&lt;/P&gt;
&lt;P&gt;after doing:&lt;/P&gt;
&lt;P&gt;var docsNameAndDatabase = GetDocumentsDatabase();&lt;/P&gt;
&lt;P&gt;you can get any document database by name:&lt;/P&gt;
&lt;P&gt;docsNameAndDatabase[currentDwgVar] returns databaseVar&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 17:12:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-specific-document-for-the-document-object/m-p/9060320#M21115</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-10-01T17:12:20Z</dc:date>
    </item>
  </channel>
</rss>

