Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hey,
im trying to change a parameter's string value to a new one by using the user input.
however, it seems like it won't change when i'm using the .setStringValue method.
( it does change when i manually insert new text to the parameter input)
any idea what can i do?
thanks!
// user input for finding the circuit string, and a new value to replace it
string find_txt = Microsoft.VisualBasic.Interaction.InputBox("Please insert the text you want to find", "find", "");
string replace_txt = Microsoft.VisualBasic.Interaction.InputBox("Please insert the text you want to REPLACE", "REPLACE", "");
IEnumerable<Element> familyInstanceCollector = new FilteredElementCollector(doc)
.OfClass(typeof(FamilyInstance)).WhereElementIsNotElementType().ToElements();// get a collection of tags
foreach(Element element in familyInstanceCollector)
{
if (element.Name == "circuit name")// looking for a specific electical fixture
{
foreach (Parameter parameter in element.Parameters)
{
if (parameter.HasValue)
{
if(parameter.AsValueString().Contains(find_txt))
{
parameter.SetValueString(replace_txt);
TaskDialog.Show("show parameter value", parameter.AsValueString());// should show the new given input value
}
}
//TaskDialog.Show("shwo parameter name", parameter.Definition.Name);
}
}
Solved! Go to Solution.