Community
if(selection.Elements.Size == 1) { System.Collections.IEnumerator es = selection.Elements.GetEnumerator(); es.MoveNext(); Type t = es.Current.GetType(); switch (t.FullName) { case "Autodesk.Revit.DB.ImportInstance": TaskDialog.Show("test", "Revit file selected."); break; case "Autodesk.Revit.DB.Instance": TaskDialog.Show("test", "Revit file selected."); break; case "Autodesk.Revit.DB.FamilyInstance": TaskDialog.Show("test", "Revit family selected."); break; default: TaskDialog.Show("test", "Default switch case."); break; } }
I'm just wondering how safe the code above is to use? Namely, if this is used in a foreign country do the class names change?
Solved! Go to Solution.
Solved by ollikat. Go to Solution.
I don't know about the safety but wouldn't it also work like this (C++):
"if (t == ImportInstance::typeId)"
TaskDialog.Show("test", "Revit file selected.");
(I'm not sure about C#...typeof(ImportInstance) might be the same thing...?)
Think that this might be more robust way of doing that.