.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linetype Definition Inside a DWG

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
GTVic
515 Views, 2 Replies

Linetype Definition Inside a DWG

Is it possible to examine the linetype definition stored in a drawing. I would like to update linetypes that use an old SHX file with newer definitions but because the name of the linetype can change (RENAME or XREF merging) the only way to reliably do this is to look at the definition (e.g. A,7.25,[LINE5,old.shx],9.25,-5) of a linetype and update it (e.g. A,7.25,[LINE5,new.shx],9.25,-5). Is this possible with .NET or LSP?

 

Thanks

2 REPLIES 2
Message 2 of 3
Jeffrey_H
in reply to: GTVic

I am sure you figure which property to use to check against

 

 

 

        <CommandMethod("LineTypeDefs")> _
        Public Sub LineTypeDefs()
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            Dim db As Database = doc.Database
 
 
            Using trx As Transaction = db.TransactionManager.StartTransaction()
                Dim lineTble As LinetypeTable = trx.GetObject(db.LinetypeTableId, OpenMode.ForRead)
 
                For Each lineTypeId As ObjectId In lineTble
                    Dim lineTblRcd As LinetypeTableRecord = trx.GetObject(lineTypeId, OpenMode.ForRead)
                    ed.WriteMessage("{3}{0}{3}     {1}{3}     {2}{3}",
                                    lineTblRcd.Name, lineTblRcd.AsciiDescription, lineTblRcd.Comments, vbCrLf)
                Next
                trx.Commit()
            End Using
 
        End Sub
   [CommandMethod("LineTypeDefs")]
        public void LineTypeDefs()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument; // Active Document
            Editor ed = doc.Editor; // Active Document's Editor
            Database db = doc.Database; // Active Document Database
           
         
 
            using (Transaction trx = db.TransactionManager.StartTransaction())
            {
                LinetypeTable lineTble = (LinetypeTable)trx.GetObject(db.LinetypeTableId, OpenMode.ForRead);
 
                foreach (ObjectId lineTypeId in lineTble)
                {
                    LinetypeTableRecord lineTblRcd = (LinetypeTableRecord)trx.GetObject(lineTypeId, OpenMode.ForRead);
                    ed.WriteMessage("\n{0}\n      {1}\n        {2}", lineTblRcd.Name, lineTblRcd.AsciiDescription, lineTblRcd.Comments);
                }
                trx.Commit();
            }       
 
        }
You can also find your answers @ TheSwamp
Message 3 of 3
GTVic
in reply to: Jeffrey_H

Thank you very much. I'm hoping AsciiDescription will be writeable, that would make it easy to update the definition.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost