Message 1 of 6
Problem with get_Parameter

Not applicable
08-19-2015
10:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone:
I've been trying to modifiy a parameter of an element. In my code I call the method "ModificarParametroElemento" with a specific parameter name, but the problem is when i calling the class "get_Parameter()" because the class only accepts (GUID's, BuiltInParameter, Definitions) and I dont know how i get the element parameter with my string text.
Thanks!
//IN THIS PART I'VE BEEN CALLING THE METHOD "ModificarParametrosElemento" TO PROCEED
this.ModificaParametrosElemento(elementId2.IntegerValue, num3.ToString(), this.document, "Union 16");
//METHOD private bool ModificaParametrosElemento(int ID, string ValorParam, Document Documento, string StrParametro) { bool result; try { ElementId elementId = new ElementId(ID); Element element = this.document.GetElement(elementId); if (element != null) { ParameterSet arg_20_0 = element.Parameters; Parameter parameter = element.get_Parameter(StrParametro); if (parameter != null) { switch (parameter.StorageType) { case (StorageType)(1): element.get_Parameter(StrParametro).Set(Convert.ToInt32(ValorParam)); break; case (StorageType)(2): element.get_Parameter(StrParametro).Set(double.Parse(ValorParam)); break; case (StorageType)(3): element.get_Parameter(StrParametro).Set(ValorParam); break; case (StorageType)(4): element.get_Parameter(StrParametro).Set(new ElementId(int.Parse(ValorParam))); break; } } } result = true; } catch (Exception ex) { TaskDialog.Show("ModificaParametrosElemento", ex.Message, (TaskDialogCommonButtons)(1)); result = false; } return result; }