Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to isolate AssemblyInstance

3 REPLIES 3
Reply
Message 1 of 4
gopinath.rajendran
449 Views, 3 Replies

Unable to isolate AssemblyInstance

Macro function to Isolate selected assembly instances. After the isolation view is empty.

public void IsolateAssembly()
        {
            UIDocument uiDoc = ActiveUIDocument;
            Document doc = uiDoc.Document;
            
            List<ElementId> elements = new List<ElementId>();
            
            foreach (var id in uiDoc.Selection.GetElementIds())
            {
                Element tempElem = doc.GetElement(id);
                if(tempElem is AssemblyInstance)
                {
                    elements.Add(tempElem.Id);
                }
            }
            
            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Isolate Assembly");
                doc.ActiveView.IsolateElementsTemporary(elements);
                uiDoc.RefreshActiveView();                
                tx.Commit();
            }
        }

 

3 REPLIES 3
Message 2 of 4

Assembly instance is just the container so you need to get the members via AssemblyInstance.GetMemberIds and isolate those with the assembly instance.

 

 

AssemblyInstance El = Doc.GetElement(R) as AssemblyInstance;

			ICollection<ElementId> EIDs = El.GetMemberIds();
			EIDs.Add(El.Id);
			using (Transaction Tx = new Transaction(Doc, "Temp isolate"))
			{
				if (Tx.Start() == TransactionStatus.Started)
				{
					UIDoc.ActiveGraphicalView.IsolateElementsTemporary(EIDs);
					Tx.Commit();
				}
			}

 

Message 3 of 4

If I isolate assembly through RevitIsolateAsAssembly.PNG

If I isolate through collecting member ids the result is not the same. I need to isolate assembly instances like Revit not the members of assembly instances.
IsolateAsElements.PNG

Message 4 of 4

Isolating elements in view and what is contained in the current selection are two different things. So after isolating all of the objects try setting the current selection to the assembly instance only.

 

UIDocument.Selection.SetElementIds()

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community