public static void DetectSelfIntersection() // mod 20130202 { ObjectId[] ids = QuickSelection.SelectAll("LWPOLYLINE").ToArray(); ProgressMeter meter = new ProgressMeter(); meter.Start("Detecting..."); meter.SetLimit(ids.Length); var results = ids.QWhere(x => { bool result = (x as Polyline).IsSelfIntersecting(); meter.MeterProgress(); System.Windows.Forms.Application.DoEvents(); return(result); }).ToList(); meter.Stop(); if (results.Count() > 0) { Interaction.WriteLine("{0} detected.", results.Count()); Interaction.ZoomHighlightView(results); } else { Interaction.WriteLine("0 detected."); } }