Unable to isolate AssemblyInstance

Unable to isolate AssemblyInstance

gopinath.rajendran
Advocate Advocate
693 Views
3 Replies
Message 1 of 4

Unable to isolate AssemblyInstance

gopinath.rajendran
Advocate
Advocate

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();
            }
        }

 

0 Likes
694 Views
3 Replies
Replies (3)
Message 2 of 4

RPTHOMAS108
Mentor
Mentor

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();
				}
			}

 

0 Likes
Message 3 of 4

gopinath.rajendran
Advocate
Advocate

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

0 Likes
Message 4 of 4

RPTHOMAS108
Mentor
Mentor

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()

0 Likes