<?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 Specific Name Layouts Name and Build a list in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331667#M48683</link>
    <description>&lt;P&gt;I like this method the best. &amp;nbsp;there are more. &amp;nbsp;if you think there are more than 50, increase the number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;Serializable()&amp;gt; _&lt;BR /&gt;Public Class LayoutNames&lt;/P&gt;&lt;P&gt;#Region "Declarations"&lt;BR /&gt;Private _LayoutName(0 To 50) As String&lt;BR /&gt;Private _LayoutNumber(0 To 50) As Integer&lt;BR /&gt;#End Region&lt;/P&gt;&lt;P&gt;#Region "Layout General Properties"&lt;BR /&gt;Public Property LayoutName(ByVal x As Integer) As String&lt;BR /&gt;Get&lt;BR /&gt;Return _LayoutName(x)&lt;BR /&gt;End Get&lt;BR /&gt;Set(ByVal value As String)&lt;BR /&gt;_LayoutName(x) = value&lt;BR /&gt;End Set&lt;BR /&gt;End Property&lt;/P&gt;&lt;P&gt;Public Property LayoutNumber(ByVal x As Integer) As Integer&lt;BR /&gt;Get&lt;BR /&gt;Return _LayoutNumber(x)&lt;BR /&gt;End Get&lt;BR /&gt;Set(ByVal value As Integer)&lt;BR /&gt;_LayoutNumber(x) = value&lt;BR /&gt;End Set&lt;BR /&gt;End Property&lt;/P&gt;&lt;P&gt;#End Region&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Private Sub fix()&lt;BR /&gt;Dim numberoflayouts As Integer&lt;BR /&gt;Dim LON As New LayoutNames&lt;BR /&gt;Dim x As Integer&lt;/P&gt;&lt;P&gt;numberoflayouts = 10&lt;BR /&gt;For x = 0 To numberoflayouts&lt;BR /&gt;LON.LayoutName(x) = "Name"&lt;BR /&gt;LON.LayoutNumber(x) = x&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2013 15:47:44 GMT</pubDate>
    <dc:creator>jaboone</dc:creator>
    <dc:date>2013-07-16T15:47:44Z</dc:date>
    <item>
      <title>Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331368#M48672</link>
      <description>&lt;P&gt;I am trying to first get all the layouts name and add specfic layouts names to the list and call a specfic function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far this what I got so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to get list all the layouts in the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   ' List all the layouts in the current drawing
        &amp;lt;CommandMethod("ListLayouts")&amp;gt; _
        Public Shared Sub ListLayouts()
            ' Get the current document and database
            Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
            Dim acCurDb As Database = acDoc.Database

            Dim i As Integer = 0

            Do While (i &amp;lt; 10)

            Loop

            ' Get the layout dictionary of the current database
            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
                Dim lays As DBDictionary = _
                    acTrans.GetObject(acCurDb.LayoutDictionaryId, OpenMode.ForRead)

                acDoc.Editor.WriteMessage(vbLf &amp;amp; "Layouts:")

                ' Step through and list each named layout and Model
                For Each item As DBDictionaryEntry In lays
                    acDoc.Editor.WriteMessage(vbLf &amp;amp; "  " &amp;amp; item.Key)
                Next

                ' Abort the changes to the database
                acTrans.Abort()
            End Using
        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 12:16:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331368#M48672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-16T12:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331515#M48673</link>
      <description>&lt;P&gt;Hi Apatel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry but your request is a bit obscure, to say the least... What is it that you are trying to do exactly and are you having any issue with the code you pointed out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some samples that use the LayoutManager:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("IterateLayouts")]
static public void IterateLayouts()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    Editor ed = doc.Editor;

    using (Transaction Tx = db.TransactionManager.StartTransaction())
    {
        using (DBDictionary layoutDict = Tx.GetObject(
            db.LayoutDictionaryId, 
            OpenMode.ForRead) as DBDictionary)
        {
            foreach (DBDictionaryEntry entry in layoutDict)
            {
                ed.WriteMessage("\n - Layout: " + entry.Key + 
                    " ObjectId: " + entry.Value.ToString());
            }   
        }

        Tx.Commit();
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("NewLayout")]
static public void NewLayout()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    Editor ed = doc.Editor;

    string layoutName = "MyLayout";

    using (Transaction Tx = db.TransactionManager.StartTransaction())
    {
        LayoutManager layoutMgr = LayoutManager.Current;

        ObjectId layoutId = layoutMgr.CreateLayout(layoutName);

        Layout layout = Tx.GetObject(layoutId, OpenMode.ForWrite) 
            as Layout;
                
        layout.Initialize();

        Tx.Commit();
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:06:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331515#M48673</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-07-16T14:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331527#M48674</link>
      <description>&lt;P&gt;I am trying to search through the layouts and bring back only specific layouts names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add to list if &amp;nbsp;layouts that begin with "Page #".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:12:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331527#M48674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-16T14:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331536#M48675</link>
      <description>&lt;P&gt;Ok... then what is the issue you are facing now? looking at the IterateLayout code I provided, this should be quite straighforward to build a list based on specific layout names...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:15:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331536#M48675</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-07-16T14:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331538#M48676</link>
      <description>&lt;P&gt;Perhaps a c to vb converter.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://www.developerfusion.com/tools/convert/csharp-to-vb/"&gt;http://www.developerfusion.com/tools/convert/csharp-to-vb/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:19:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331538#M48676</guid>
      <dc:creator>jaboone</dc:creator>
      <dc:date>2013-07-16T14:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331545#M48677</link>
      <description>&lt;P&gt;I am using the convertor now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is while statement best to build a list.&lt;/P&gt;&lt;P&gt;Can you let me know the best approach?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:21:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331545#M48677</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-16T14:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331579#M48678</link>
      <description>&lt;P&gt;It's not really a forum where we teach people the basics of programming. The conditional structure you are using, whether it's a While, foreach, or other kind of loop depends on several factors, one can be a personal preference, a performance criteria and so on... i would say on such a basic scenario, it doesn't really matter if you use a while or foreach loop, the execution time will be so neglectible that both approaches will work. I have a preference for a foreach loop in that case, since you want to iterate the whole collection of layouts anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:45:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331579#M48678</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-07-16T14:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331584#M48679</link>
      <description>&lt;P&gt;Ok. can you point me a sample how this is created.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:49:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331584#M48679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-16T14:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331589#M48680</link>
      <description>&lt;P&gt;You want to know how to build a list in VB.Net...? The easiest way is to type "using list vb.net" in your favorite search engine.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:51:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331589#M48680</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-07-16T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331596#M48681</link>
      <description>&lt;P&gt;For a list there are many methods. &amp;nbsp;To check the list against a known value there are also many other methods.&lt;/P&gt;&lt;P&gt;You have to be more specific.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 14:54:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331596#M48681</guid>
      <dc:creator>jaboone</dc:creator>
      <dc:date>2013-07-16T14:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331611#M48682</link>
      <description>&lt;P&gt;Search aganist a specfic layouts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to bring back files with name starts with "Page #"&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 15:06:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331611#M48682</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-16T15:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331667#M48683</link>
      <description>&lt;P&gt;I like this method the best. &amp;nbsp;there are more. &amp;nbsp;if you think there are more than 50, increase the number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;Serializable()&amp;gt; _&lt;BR /&gt;Public Class LayoutNames&lt;/P&gt;&lt;P&gt;#Region "Declarations"&lt;BR /&gt;Private _LayoutName(0 To 50) As String&lt;BR /&gt;Private _LayoutNumber(0 To 50) As Integer&lt;BR /&gt;#End Region&lt;/P&gt;&lt;P&gt;#Region "Layout General Properties"&lt;BR /&gt;Public Property LayoutName(ByVal x As Integer) As String&lt;BR /&gt;Get&lt;BR /&gt;Return _LayoutName(x)&lt;BR /&gt;End Get&lt;BR /&gt;Set(ByVal value As String)&lt;BR /&gt;_LayoutName(x) = value&lt;BR /&gt;End Set&lt;BR /&gt;End Property&lt;/P&gt;&lt;P&gt;Public Property LayoutNumber(ByVal x As Integer) As Integer&lt;BR /&gt;Get&lt;BR /&gt;Return _LayoutNumber(x)&lt;BR /&gt;End Get&lt;BR /&gt;Set(ByVal value As Integer)&lt;BR /&gt;_LayoutNumber(x) = value&lt;BR /&gt;End Set&lt;BR /&gt;End Property&lt;/P&gt;&lt;P&gt;#End Region&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Private Sub fix()&lt;BR /&gt;Dim numberoflayouts As Integer&lt;BR /&gt;Dim LON As New LayoutNames&lt;BR /&gt;Dim x As Integer&lt;/P&gt;&lt;P&gt;numberoflayouts = 10&lt;BR /&gt;For x = 0 To numberoflayouts&lt;BR /&gt;LON.LayoutName(x) = "Name"&lt;BR /&gt;LON.LayoutNumber(x) = x&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 15:47:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331667#M48683</guid>
      <dc:creator>jaboone</dc:creator>
      <dc:date>2013-07-16T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get Specific Name Layouts Name and Build a list</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331670#M48684</link>
      <description>&lt;P&gt;of course the lines of code in sub 'fix' will have to be integrated into your while, but it gives the idea.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 15:49:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-specific-name-layouts-name-and-build-a-list/m-p/4331670#M48684</guid>
      <dc:creator>jaboone</dc:creator>
      <dc:date>2013-07-16T15:49:25Z</dc:date>
    </item>
  </channel>
</rss>

