<?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: How to list all linetype of Acad.lin in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396281#M56481</link>
    <description>&lt;P&gt;You could also mkaybe do something like this?&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("ListLineTypes")]
        public void ListLineTypes()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            string path = HostApplicationServices.Current.FindFile("acad.lin", db, FindFileHint.Default);

            using (StreamReader sr = new StreamReader(path))
            {
                Char[] c = new Char[] { ',' };
                while (sr.Peek() &amp;gt;= 0)
                {                   
                    string s = sr.ReadLine();
                    if (s.StartsWith("*"))
                    {
                    string[] info = s.Split(c);
                    ed.WriteMessage("\nName:{0} --- Description:{1}", info[0].Substring(1), info[1]);
                    
                    }

                }            
            }

        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Apr 2012 02:45:23 GMT</pubDate>
    <dc:creator>jeff</dc:creator>
    <dc:date>2012-04-03T02:45:23Z</dc:date>
    <item>
      <title>How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3394733#M56478</link>
      <description>&lt;P&gt;here my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Function LectureDefLine() As Collection
        Dim db As Database = New Database(True, False)
        Dim OkErreur As Boolean = False
        dim cCollDefTypeLine as collection = New Collection

        Try
            Dim path As String = HostApplicationServices.Current.FindFile("acad.lin", db, FindFileHint.Default)

            db.LoadLineTypeFile("*", path)
        Catch ex As Autodesk.AutoCAD.Runtime.Exception
            If (ex.ErrorStatus = Autodesk.AutoCAD.Runtime.ErrorStatus.FilerError) Then
                MsgBox("Impossible de trouver le fichier " &amp;amp; "acad.lin", MsgBoxStyle.Information, "Erreur système")
                OkErreur = True
            ElseIf (ex.ErrorStatus = Autodesk.AutoCAD.Runtime.ErrorStatus.DuplicateRecordName) Then
                'Ligne déja connu --&amp;gt; passe
            Else
                MsgBox(ex.ToString, MsgBoxStyle.Information, "Erreur système")
                OkErreur = True
            End If
        End Try

        If OkErreur = False Then
            'iterate les typeline
            Dim tr As Transaction = db.TransactionManager.StartTransaction()
            Try
                Dim TypelineT As DBObject = tr.GetObject(db.LinetypeTableId, OpenMode.ForRead)
                Dim tbl As SymbolTable = CType(TypelineT, SymbolTable)
                If IsNothing(tbl) = False Then
                    Dim tblRecId As ObjectId
                    For Each tblRecId In tbl
                        Dim tmpObj1 As DBObject = tr.GetObject(tblRecId, OpenMode.ForRead)
                        Dim rec As SymbolTableRecord = CType(tmpObj1, LinetypeTableRecord)
                        If Not (rec Is Nothing) Then
                            cCollDefTypeLine.Add(rec.Name, rec.Name)
                            'ed.WriteMessage("Adding LineType " &amp;amp; rec.Name &amp;amp; vbCrLf)
                        End If
                    Next
                End If
            Catch ex As Exception
                MsgBox(ex.ToString, MsgBoxStyle.Information, "err")
            Finally
                tr.Commit()
                tr.Dispose()
            End Try
        End If
        db.Dispose()
        db = Nothing
        Return cCollDefTypeLine
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;cCollDefTypeLine : i use it for populate a ComboxColumn of a dataview.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want populate a ColumnDataview but not integrate all the linetype in mu current dwg.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code run but acad crash after ..&amp;nbsp;&amp;nbsp; So have you a function/sub working fine ?&lt;/P&gt;&lt;P&gt;Thx All&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2012 05:19:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3394733#M56478</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-02T05:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3395627#M56479</link>
      <description>&lt;P&gt;There was a post on this subject here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2010/03/loading-multiple-linetypes-into-autocad-using-net.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/03/loading-multiple-linetypes-into-autocad-using-net.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quigs.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2012 16:31:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3395627#M56479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-02T16:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396099#M56480</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;I'm Not 100% sure this will solve the problem, but try calling db.CloseInput(True) before calling db.Dispose.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2012 22:08:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396099#M56480</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-04-02T22:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396281#M56481</link>
      <description>&lt;P&gt;You could also mkaybe do something like this?&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("ListLineTypes")]
        public void ListLineTypes()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            string path = HostApplicationServices.Current.FindFile("acad.lin", db, FindFileHint.Default);

            using (StreamReader sr = new StreamReader(path))
            {
                Char[] c = new Char[] { ',' };
                while (sr.Peek() &amp;gt;= 0)
                {                   
                    string s = sr.ReadLine();
                    if (s.StartsWith("*"))
                    {
                    string[] info = s.Split(c);
                    ed.WriteMessage("\nName:{0} --- Description:{1}", info[0].Substring(1), info[1]);
                    
                    }

                }            
            }

        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 02:45:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396281#M56481</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2012-04-03T02:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396367#M56482</link>
      <description>&lt;P&gt;thank all&lt;/P&gt;&lt;P&gt;DesignProQuiq --&amp;gt; I dont want load all typeline in my current drawing.&lt;/P&gt;&lt;P&gt;Jeff --&amp;gt; Oh i have to test that tomorrow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 05:25:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3396367#M56482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-03T05:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3397441#M56483</link>
      <description>&lt;P&gt;Thx it is working good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the code in vb.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Public Function LectureDefLine() As Collection
        'chargement des type de ligne connu
        Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        'Dim ed As Autodesk.AutoCAD.EditorInput.Editor = doc.Editor
        cCollDefTypeLine = New Collection

        Dim path As String = HostApplicationServices.Current.FindFile(NomFichierLigne, db, FindFileHint.Default)

        Using sr As System.IO.StreamReader = New System.IO.StreamReader(path)

            Dim c As Char() = New Char() {","}
            While (sr.Peek() &amp;gt;= 0)
                Dim s As String = sr.ReadLine()
                If (s.StartsWith("*")) Then

                    Dim info() As String = s.Split(c)
                    'ed.WriteMessage("\nName:{0} --- Description:{1}", info(0).Substring(1), info(1))
                    cCollDefTypeLine.Add(info(0).Substring(1), info(0).Substring(1))
                End If

            End While
        End Using

        Return cCollDefTypeLine
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 17:24:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3397441#M56483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-03T17:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all linetype of Acad.lin</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3397687#M56484</link>
      <description>&lt;P&gt;I swear I posted this last night, but it is not here now, so here it is again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed something, and checked my own code, and I believe the problem with your original code was the New Database constructor.&amp;nbsp; My code is always reading an existing drawing, and calls New Database (False, True).&amp;nbsp; With your code creating a databse from scratch, I think you&amp;nbsp;did need the first argument {buildDefaultDrawing}&amp;nbsp;to be True, but you definitely needed the second argument {noDocument} to be True.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is pretty much "For your information", because I agree that if all you need is a list of linetype names, it is better to just parse them out of the text file than to do all that stuff with the new database.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2012 19:34:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-list-all-linetype-of-acad-lin/m-p/3397687#M56484</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-04-03T19:34:04Z</dc:date>
    </item>
  </channel>
</rss>

