Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66705

Re: Importing only selected Family Sizes

$
0
0

The final sollution was very similar and along suggestions from  :

var _path = Path.ChangeExtension(familyFilePath, "txt"); if (File.Exists(_path)) { using (var tr2 = new Transaction(doc, $"REVO - Creating types'{fileName}'")) { tr2.Start(); var success = FamilySizeTableManager.CreateFamilySizeTableManager(doc, family.Id); var fstm = FamilySizeTableManager.GetFamilySizeTableManager(doc, family.Id); var fstei = new FamilySizeTableErrorInfo(); try { success = fstm.ImportSizeTable(doc, _path, fstei); } catch { Log.Error("Exception, probably erroneous/malformed Type catalog table"); tr2.RollBack(); //TODO Check for malformed stuff } if (!success) { Log.Error("Erroneous Type catalog table"); tr2.RollBack(); } var sizeTable = fstm.GetSizeTable(fileName); var typeCatalogSelectorWindow = new TypeCatalogSelectorWindow(sizeTable); typeCatalogSelectorWindow.ShowDialog(); var _dict = typeCatalogSelectorWindow.RowDict; if (typeCatalogSelectorWindow.IsOK) { foreach (ElementId fsids in family.GetFamilySymbolIds()) { var elemType = doc.GetElement(fsids) as ElementType; if (!_dict[elemType.Name].ToBeAdded) doc.Delete(fsids); } tr2.Commit(); } else { tr2.RollBack(); } } }

To summarize that, at first I load family with all sizes and then I search for unselected Sizes by their ID and delete what is not needed.


Viewing all articles
Browse latest Browse all 66705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>