How to add subelements to selection?

How to add subelements to selection?

YarUnderoaker
Collaborator Collaborator
823 Views
4 Replies
Message 1 of 5

How to add subelements to selection?

YarUnderoaker
Collaborator
Collaborator

Hi.

It is possible to add subelements of structural connection to ActiveUIDocument.Selection ?

Subelements does not have ElementId so it can not be added as usual.

 

0 Likes
824 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Absolutely!!

 

UIDocument pUIDoc = this.ActiveUIDocument;
var lSelectedIds = pUIDoc.Selection.GetElementIds().ToList();
List<ElementId> lSubIds = new List<ElementId>();

foreach (var pId in lSelectedIds)
{
	Element pElt = pUIDoc.Document.GetElement(pId);
	if (pElt is FamilyInstance)
	{
		FamilyInstance pFamInst = pElt as FamilyInstance;
		if (pFamInst != null)
			lSubIds.AddRange(pFamInst.GetSubComponentIds());
	}
}

lSelectedIds.AddRange(lSubIds);

Hope that helps.  Let me know if you have any questions about any of that!!

 

Don't forget to mark your answers...  It helps the next individual find theirs faster!!

Cheers, 

 

Geoff Overfield

Senior Software Engineer

FabPro, LLC

FP_Logo(2).png

0 Likes
Message 3 of 5

YarUnderoaker
Collaborator
Collaborator

No, it is subcomponents. But there is new entity - subelements. They has no ElementId, but can be selected in Revit by pushing Tab on it master. 

There is deadlock situation. Structural connection's subelement can be selected nor via schedule neither API.

If user want to write value to some parameters it must manually click one by one each subelement in model.

0 Likes
Message 4 of 5

YarUnderoaker
Collaborator
Collaborator

I still searching solution 😓.

0 Likes
Message 5 of 5

jeremytammik
Autodesk
Autodesk

If it can be selected by tabbing, it can presumably be represented by a stable reference.

  

There have been several discussions in the past here and by The Building Coder concerning stable references and their use in dimensioning and other areas:

 

   

I don't know off-hand whether they might also enable selection as well...

  

Search this forum for 'stable reference' and see whether you strike lucky.

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes