- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, Colleagues,
I'm new to Revit API. And I can't see the Revit links from the Method in the ComboBox.
public static IList<Document> GetAllRevitLinkInstances(ExternalCommandData commandData) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document arDoc = uidoc.Document; FilteredElementCollector collector = new FilteredElementCollector(arDoc); collector.OfClass(typeof(RevitLinkInstance)).ToList(); IList<Document> linkedDocs = new List<Document>(); foreach (Element elem in collector) { RevitLinkInstance instance = elem as RevitLinkInstance; Document linkDoc = instance.GetLinkDocument(); linkedDocs.Add(linkDoc); } return linkedDocs; }
In MVVM I use:
public Document SelectedLinkedInstances { get; set; } public IList<Document> LinkedInstances { get; } = new List<Document>(); public MainViewViewModel(ExternalCommandData commandData) { _commandData = commandData; SaveCommand = new DelegateCommand(OnSaveCommand); LinkedInstances = LinkUtils.GetAllRevitLinkInstances(commandData);}
But in the ComboBox finally I see only empty lines. So, the docs are not seen in the ComboBox. May be someone faced the same problem?
But in the ComboBox finally I see only empty lines. So, the docs are not seen in the ComboBox. May be someone faced the same problem?
Solved! Go to Solution.