Can we access the System Family Name instead of a typical family

Can we access the System Family Name instead of a typical family

Anonymous
Not applicable
734 Views
1 Reply
Message 1 of 2

Can we access the System Family Name instead of a typical family

Anonymous
Not applicable

Untitled.png

 

I can access family and get their names, but it is only limited to typical one. Can i access system family like Rectangular Duct or Basic walls by API.

 

string target = "";

if ( e is FamilyInstance)
{
          FamilyInstance fInstance = e as FamilyInstance;
          FamilySymbol fSymbol = fInstance.Symbol;
          Family family = fSymbol.Family;
          target = family.Name;
}
0 Likes
735 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I think what you are looking for is a parameter of the element's type. So as shown by others:

 

ElementId elemTypeId = elem.GetTypeId();
    		ElementType elemType = (ElementType)doc.GetElement(elemTypeId);
    		ShowParameters(elemType, "Type parameters");


	// show all parameters values for an element
		public void ShowParameters(Element elem , string header){
			string s = string.Empty;
			foreach (Parameter param in elem.Parameters)
			{
				string name = param.Definition.Name;
				string val = ParameterToString(param);
				s += name + " = " + val + "\n";
			}
			TaskDialog.Show(header,s);
		}
		
		// helper:paramtertostring		
		public static string ParameterToString(Parameter param){
			string val = "none";
			if (param ==null){
				return val;
			}
			// we need to parse depending on type
			switch(param.StorageType){
				case StorageType.Double:
					double dVal = param.AsDouble();
					val = dVal.ToString();
					break;
				case StorageType.Integer:
					int iVal = param.AsInteger();
					val = iVal.ToString();
					break;
				case StorageType.String:
					string sVal = param.AsString();
					val = sVal;
					break;
				case StorageType.ElementId:
					ElementId idVal = param.AsElementId();
					val = idVal.IntegerValue.ToString();
					break;
				default:
					break;
			}
			return val;	
		}
	
0 Likes