I can return all Line Patterns and IDs with:
FilteredElementCollector collector = newFilteredElementCollector(doc);
IList<Element> elems = collector.OfClass(typeof(LinePatternElement)).ToElements();
then process elems to select ones to purge, and add to:
IList <ElementId> idsToDelete = newList<ElementId>();
then delete by element iD:
tr.Start();
// all at once
// doc.Delete(idsToDelete);
// or
foreach (ElementId eid in idsToDelete)
{
doc.Delete(eid);
}
tr.Commit();
However the elements (Line Patterns) are not being deleted from the document. Any thoughts? Thanks, Dale
Did you try to make a collection of linepatterns like
doc.LinePatterns()
and delete each element in the collection like :
foreach (LinePatternElement line in doc.LinePatterns())
{
doc.Delete(line.Id);
}
Thanks for the reply.
There is no definition for doc.LinePatterns...
Dale
Thanks Remy,
There have been some other published macros using similar code that presumably work. I haven't tested my code in multiple files, so possibly there is something in the file itself. Dale