Message 1 of 7

Not applicable
11-22-2015
01:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I wanna loop through elements of a chosen familie in a project.
I have this code, but i can't set the parameter. What am i doing wrong? Please help. Thnx in advanced.
//Get application and document objects
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
//Create collector with the filter Family
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector = collector.OfClass(typeof(Family));
//Get ID from te family with linq-code
var query = from element in collector where element.Name.StartsWith("300_32_ISR_wandopening_houten_binnenkozijn_60WBDBO") select element;
List<Element> fams = query.ToList<Element>();
ElementId famId = fams[0].Id;
//Create FamilySymbolFilter by FamilyID
FamilySymbolFilter filter = new FamilySymbolFilter(famId);
//Create collector filtered by FamilyID and put familysymbols in ICollection : dus alle familytypen in collector plaatsen.
collector = new FilteredElementCollector(doc);
ICollection<Element> Familysymbols = collector.WherePasses(filter).ToElements();
//Create string for testing results
string prompt = "alle deurtypes van familiy 300_32_ISR_wandopening_houten_binnenkozijn_60WBDBO: ";
//Create list to put in FamilySymbol-ID's : dus lijst creeren om alle ID's van de familytypen erin te plaatsen.
List<ElementId> lstFamilySymbolIDs = new List<ElementId>();
//---> Get all FamilySymbol-ID's and put them in a list. : dus alle ID's in de lijst stoppen.
foreach (Element el in Familysymbols)
{
prompt += "\n";
prompt += el.Name + "\n";
prompt += el.Id + "\n";
lstFamilySymbolIDs.Add(el.Id);
Parameter p = el.LookupParameter("Finish");
p.Set("test-waarde");
//el.LookupParameter("MyParam").Set("TestValue");
el.get_Parameter("Finish").Set("test-waarde");
I wanna loop through elements of a chosen familie in a project.
I have this code, but i can't set the parameter. What am i doing wrong? Please help. Thnx in advanced.
//Get application and document objects
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
//Create collector with the filter Family
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector = collector.OfClass(typeof(Family));
//Get ID from te family with linq-code
var query = from element in collector where element.Name.StartsWith("300_32_ISR_wandopening_houten_binnenkozijn_60WBDBO") select element;
List<Element> fams = query.ToList<Element>();
ElementId famId = fams[0].Id;
//Create FamilySymbolFilter by FamilyID
FamilySymbolFilter filter = new FamilySymbolFilter(famId);
//Create collector filtered by FamilyID and put familysymbols in ICollection : dus alle familytypen in collector plaatsen.
collector = new FilteredElementCollector(doc);
ICollection<Element> Familysymbols = collector.WherePasses(filter).ToElements();
//Create string for testing results
string prompt = "alle deurtypes van familiy 300_32_ISR_wandopening_houten_binnenkozijn_60WBDBO: ";
//Create list to put in FamilySymbol-ID's : dus lijst creeren om alle ID's van de familytypen erin te plaatsen.
List<ElementId> lstFamilySymbolIDs = new List<ElementId>();
//---> Get all FamilySymbol-ID's and put them in a list. : dus alle ID's in de lijst stoppen.
foreach (Element el in Familysymbols)
{
prompt += "\n";
prompt += el.Name + "\n";
prompt += el.Id + "\n";
lstFamilySymbolIDs.Add(el.Id);
Parameter p = el.LookupParameter("Finish");
p.Set("test-waarde");
//el.LookupParameter("MyParam").Set("TestValue");
el.get_Parameter("Finish").Set("test-waarde");
Solved! Go to Solution.