Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, Forum-board users! Would you so kind to give me a hint as I'm a bit confused. So, how can I get and change parameters of an active document if this document is a Family itself? If the Family is open in the project I usually do this way:
FilteredElementCollector FamilyS = new FilteredElementCollector(doc) .OfClass(typeof(FamilySymbol)); foreach (FamilySymbol FS in FamilyS) { foreach (Parameter P in FS.Parameters) { if (P.Definition.Name == "My Parameter") { //here I'm dealing with the parameter } } }
But if the open document (doc) is the Family, then doc.Parameters doesn't exist. I tried to do next:
FilteredElementCollector ParamElem = new FilteredElementCollector(familyDoc) .OfClass(typeof(ParameterElement)); foreach (ParameterElement PE in ParamElem) { if (PE.Name == "My Parameter") { //My parameter was got as a result but in PE there's no method for to change it in PE } foreach (Parameter P in PE.Parameters) { if (P.Definition.Name == "My Parameter") { //My parameter wasn't got } } }
Then I tried to do this:
FamilyManager FM = familyDoc.FamilyManager; foreach (FamilyParameter FamilyP in FM.Parameters) { if (FamilyP.Definition.Name =="My Parameter") { //My parameter was got as a result but in PE there's no method for to change it in FamilyP } foreach (Parameter P in FamilyP.AssociatedParameters) { if (P.Definition.Name == "My Parameter") { //My parameter wasn't got } } }
Fnd that's all.
Павел Тер-Микаэлян
email: psh.t@inbox.ru
email: psh.t@inbox.ru
Solved! Go to Solution.