<?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: Get full path of dwg files from a  sheetset in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9646447#M18965</link>
    <description>&lt;P&gt;Check ResolveFileName method of AcSmAcDbLayoutReference class&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jul 2020 11:28:00 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2020-07-21T11:28:00Z</dc:date>
    <item>
      <title>Get full path of dwg files from a  sheetset</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9646181#M18964</link>
      <description>&lt;P&gt;Hi, guys. I want to get the full path of every dwg files from a sheetset. What I've tried&amp;nbsp; was as following:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; // Create a new SheetSetManager
            AcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr();

            // Declare a AcSmDatabase variant
            AcSmDatabase acSheetSetDb = null;

            try
            {
                // Get the database of specified dst file
                acSheetSetDb = sheetSetManager.OpenDatabase(dstFilePath, false);
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.ToString());
            }           

            List&amp;lt;string&amp;gt; dwgFilePathList = new List&amp;lt;string&amp;gt;();

            try
            {
                acSheetSetDb.LockDb(acSheetSetDb);

                // Get the sheet set object
                AcSmSheetSet acSheetSet = acSheetSetDb.GetSheetSet();

                // Get drawings' title sorted by subcategory                
                dwgFilePathList = ProcessEnumerator(acSheetSet.GetSheetEnumerator());
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                acSheetSetDb.UnlockDb(acSheetSetDb, true);
                sheetSetManager.Close(acSheetSetDb);
            }&lt;/LI-CODE&gt;&lt;P&gt;By doing this, I can only get the file name of dwg file(like "firstFloor.dwg"). Is there anyone know how to get the full path? Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 08:49:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9646181#M18964</guid>
      <dc:creator>Miralkong</dc:creator>
      <dc:date>2020-07-21T08:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of dwg files from a  sheetset</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9646447#M18965</link>
      <description>&lt;P&gt;Check ResolveFileName method of AcSmAcDbLayoutReference class&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 11:28:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9646447#M18965</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-07-21T11:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get full path of dwg files from a  sheetset</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9650559#M18966</link>
      <description>&lt;P&gt;Thanks a lot. It works.&lt;/P&gt;&lt;P&gt;And for those who need more details. Below is what I tried:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public List&amp;lt;string&amp;gt; GetDrawingPathFromDst(string dstFilePath)
        {
            // Create a new SheetSetManager
            AcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr();

            // Declare a AcSmDatabase variant
            AcSmDatabase acSheetSetDb = null;

            try
            {
                // Get the database of specified dst file
                acSheetSetDb = sheetSetManager.OpenDatabase(dstFilePath, false);
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.ToString());
            }           

            List&amp;lt;string&amp;gt; dwgFilePathList = new List&amp;lt;string&amp;gt;();

            try
            {
                acSheetSetDb.LockDb(acSheetSetDb);

                // Get the sheet set object
                AcSmSheetSet acSheetSet = acSheetSetDb.GetSheetSet();

                // Get drawings' title sorted by subcategory   
                dwgFilePathList = ProcessEnumerator(acSheetSet.GetSheetEnumerator());
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                acSheetSetDb.UnlockDb(acSheetSetDb, true);
                sheetSetManager.Close(acSheetSetDb);
            }

            return dwgFilePathList;
        }&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt; private List&amp;lt;string&amp;gt; ProcessEnumerator(IAcSmEnumComponent iter)
        {
            List&amp;lt;string&amp;gt; filePathList = new List&amp;lt;string&amp;gt;();

            IAcSmComponent item = iter.Next();

            while (item != null)
            {
                string type = item.GetTypeName();

                if(type == "AcSmSheet")
                {
                    AcSmSheet sh = (AcSmSheet)item;
                    string filePath = sh.GetLayout().ResolveFileName();
                    if (filePath != null || filePath.Length == 0)
                        filePathList.Add(filePath);
                }

                item = iter.Next();
            }
            return filePathList;
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Jul 2020 03:21:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-full-path-of-dwg-files-from-a-sheetset/m-p/9650559#M18966</guid>
      <dc:creator>Miralkong</dc:creator>
      <dc:date>2020-07-23T03:21:48Z</dc:date>
    </item>
  </channel>
</rss>

