Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to remove all Lookup Tables inside families that start with a specific prefix.
The method "sizeTableManager.RemoveSizeTable(tableToRemove)" returns true as if it succeeded but when I go edit the families in the project and bring up the Lookup Tables list they are still there.
Any ideas as to what I'm doing wrong?
This is my code so far:
// remove old tables string existingPrefix = "ExistingPrefix_"; Document doc = this.ActiveUIDocument.Document; FilteredElementCollector collector = new FilteredElementCollector(doc); ICollection<Element> elements = collector.OfClass(typeof(Family)).ToElements(); foreach (var element in elements) { using (Transaction t = new Transaction(doc, "flush old lookup tables")) { t.Start(); FamilySizeTableManager sizeTableManager = FamilySizeTableManager.GetFamilySizeTableManager(doc, element.Id); if(sizeTableManager != null) { foreach (var tableToRemove in sizeTableManager.GetAllSizeTableNames()) { if(tableToRemove.StartsWith(existingPrefix)) { bool result = sizeTableManager.RemoveSizeTable(tableToRemove); if(result) { // TaskDialog.Show("Success", "Removed " + tableToRemove + " from " + element.Name); var test = "test"; } else { TaskDialog.Show("Warning", "Unable to remove " + tableToRemove + " from " + element.Name); } } } } var commitResult = t.Commit(); } }
Thanks in advance!
Solved! Go to Solution.