How to get ElementType.FamilyName from Linked Revit model?

Hi, we are trying to get ElementType.FamilyName from an element in Linked model and getting in some troubles.


We tried using Revit macro:

    		public void LinkedFamilyName ()
    			Reference reference = this.ActiveUIDocument.Selection.PickObject(ObjectType.LinkedElement,"select wall");
    			RevitLinkInstance revitLinkInstance  = this.ActiveUIDocument.Document.GetElement(reference) as RevitLinkInstance;
    			Element element = revitLinkInstance.GetLinkDocument().GetElement(reference.LinkedElementId);
    			ElementType elementtype = revitLinkInstance.GetLinkDocument().GetElement(element.GetTypeId()) as ElementType;
    			string name = elementtype.FamilyName;

We tried using Revit macro and got name: Basic Wall as on the image.

We tried the same with GH but struggling to access this data and it returns the empty string.
Here is our C# node in GH that does not work

  private void RunScript(System.Object LinkedHost, ref object A)


  // <Custom additional code> 
  Autodesk.Revit.DB.Wall wall = LinkedHost as Autodesk.Revit.DB.Wall;
  Autodesk.Revit.DB.ElementType elementType = wall.Document.GetElement(wall.GetTypeId());

  string name = elementType.FamilyName;

  A = name;

  // </Custom additional code> 

Wall are kinda different. For walls use the WallKind property on the DB.Wall instance. It returns an enum value denoting the wall type group. See DB.WallKind

See this article for some clarifications on the System vs Custom Types:


Thanks for your reply, this solution is fine as workaround however we are looking for more generic solution. All ElementTypes have FamilyName property and in Revit (API) Environment (Tested on Revit Macro and Dynamo Custom Node) it returns value different than null or Empty string. FamilyName parameter is our desire solution and what we are looking for.

Does this work for you?

If you mean by code, please update Rhino WIP to the latest and test it.

If is not working please share little sample that shows the problem.

1 Like

thanks a lot looking at this, we can replicate your approach but can not get the same in C#
here is our file,
your help will be appreciated, (5.6 KB)

we run one more test and got some strange results:
here we run debug Rhino.Inside and all works fine we have FamilyName for Element.Id = 703378

when we reference in SAM we can not get the same information, code run on the same object as you can see the same Element.Id = 703378

Have you done anything special in ElementType.Identity component?