Message 1 of 5
Get assembly IDs and names

Not applicable
01-14-2020
11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on C# application and I would like to get a list of assemblies in an Revit existing file. I was able to find an example showing how to create an assembly and name it, but if assemblies are already created how would I get a list of those assembly IDs (to create views) and names?
This is part of what I have so far:
// Create assembly of selected components transaction.Start("Create Assembly Instance"); AssemblyInstance assemblyInstance = AssemblyInstance.Create(doc, uidoc.Selection.GetElementIds(), categoryId); transaction.Commit(); // need to commit the transaction to complete the creation of the assembly instance so it can be accessed in the code below if (transaction.GetStatus() == TransactionStatus.Committed) { // Set assembly name transaction.Start("Set Assembly Name"); assemblyInstance.AssemblyTypeName = "My Assembly Name"; transaction.Commit(); }
Any help would be greatly appreciated. Thank you