public static List<string> MaterialInfo(String elemento)
{
List<string> DataCbm = new List<string>();
List<Element> Materiales = new List<Element>();
List<string> strs1;
foreach (Element el in lstElement)
{
if (Util.ParameterToString(el.LookupParameter("Elemento")) == elemento)
{
ICollection<ElementId> materialIds = el.GetMaterialIds(false);
strs1 = new List<string>();
strs1.Clear();
foreach (ElementId materialId in materialIds)
{
//Materiales.Add(docGeneral.GetElement(materialId));
strs1.Add(docGeneral.GetElement(materialId).Name);
DataCbm.Add(strs1[0]);
}
}
}
var query = from item in DataCbm
let palabra = item
group item by palabra into g
select new { Key = g.Key, Values = g };
List<string> lista = new List<string>();
foreach (var item in query)
{
lista.Add(item.Key);
}
return lista;
}
Thanks for your reply yeremy.
I have tried to implement this code where I get the list of materials used in selected items. But it is very bad as I try luck. Some advice to get directly the name of the structural material that an element uses. One method would be helpful.
Thank you,