To set the parameter value I need to iterate through all the Parameters for single parameter it is fine, but I have to edit multiple parameters for in one go than looping is not feasible as it takes too long and I need to loop to fecth each paramter say Height, Width, ....
Is there any simple way one liner code that will solve the purpose instead of looping.
example:
My Excel looks like this with three columns Type, Height, Width ,...
Type:Height:Width
Wall:2000:3000
Wall2:2343:3545
Present Code I am using for single parameter but if parameters increase its tough
foreach (Parameter Param in symbol.Parameters)
{
using (Transaction t = new Transaction(document, "Set Parameter"))
{ t.Start();
if (Param.Definition.Name == "Height"){
//TaskDialog.Show("DFF",Param.Definition.Name.ToString());
Param.SetValueString("2000");
t.Commit();
}
}
}
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Do not use the parameter name to identify it if you can avoid it:
Use a built-in parameter enum instead.
Also, there is no need to loop over all parameters.
You can access the parameter on the element directly without looping.
There are lots of examples of more efficient approaches in The Building Coder discussions.
You also simply search for the string ".Set(" in The Building Coder samples:
https://github.com/jeremytammik/the_building_coder_samples
Cheers,
Jeremy
Better still, read this:
http://thebuildingcoder.typepad.com/blog/2013/09/max-revision-wrapper-class.html
Cheers,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.