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
Solved! Go to Solution.
Solved by Jeffrey_H. Go to Solution.
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(); } }
Thank you very much. I'm hoping AsciiDescription will be writeable, that would make it easy to update the definition.