public void Setvalue(Document doc, List <FamilyInstance> list, string source) { using (Transaction tran = new Transaction(doc, "Set")) { tran.Start(); ProgressBarform progressBarform = new ProgressBarform(list.Count, "Loading..."); progressBarform.Show(); foreach (var i in list) { progressBarform.giatri(); if (progressBarform.iscontinue == false) { break; } Parameter pa1 = i.LookupParameter(source); if (pa1 != null) { ElementtransformToCopy tr = new ElementtransformToCopy(); FamilyInstance flat = tr.GetFlat(doc, i); if (flat != null) { FamilyInstance wapred = tr.GetWarped(doc, i); Parameter Fpa1 = flat.LookupParameter(source); Fpa1.Set(pa1.AsString()); Parameter Wpa1 = wapred.LookupParameter(source); Wpa1.Set(pa1.AsString()); } } } progressBarform.Close(); tran.Commit(); } }
public List <FamilyInstance> GetProducts(Document doc, string source, string target) { List <FamilyInstance> list = new List <FamilyInstance>(); var col = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfClass(typeof(IndependentTag)).Where(x => x.Category.Name == "Multi-Category Tags" || x.Category.Name == "Structural Framing Tags").Cast <IndependentTag>().ToList(); ElementtransformToCopy elementtransformToCopy = new ElementtransformToCopy(); List <FamilyInstance> listsource = new List <FamilyInstance>(); foreach (var tag in col) { FamilyInstance instancesource = (doc.GetElement(tag.TaggedLocalElementId) as FamilyInstance).GetSuperInstances(); if (instancesource.LookupParameter(source) != null && instancesource.LookupParameter(target) != null) { list.Add(instancesource); } } return(list); }