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 void Addvalue(Document doc, List <FamilyInstance> list, string pa, string value) { ProgressBarform progressBarform = new ProgressBarform(list.Count, "Running..."); progressBarform.Show(); foreach (var item in list) { progressBarform.giatri(); if (progressBarform.iscontinue == false) { break; } Parameter pa1 = item.LookupParameter(pa); if (pa1 != null) { switch (pa1.StorageType) { case StorageType.String: pa1.Set(value); break; case StorageType.Double: pa1.Set(Convert.ToDouble(value)); break; case StorageType.Integer: pa1.Set(Convert.ToInt32(value)); break; default: break; } } } progressBarform.Close(); }