Well, you should have your parameter name passed to the method ergo:
Element a = symbol as Element;
Parameter width_sym = a.LookupParameter("a1");
And from that you should get the value of parameter based on its StorageType. Since you probably know that the value is double, just use:
double value = width_sym.AsDouble();
If you do not know the StorageType, then use:
switch (width_sym.StorageType)
{
case StorageType.Double:
double doubleValue = width_sym.AsDouble();
// do your thing here
break;
case StorageType.Integer:
int intValue = width_sym.AsInteger();
// do your thing here
break;
case StorageType.ElementId:
ElementId idValue = width_sym.AsElementId();
// do your thing here
break;
case StorageType.String:
string stringValue = width_sym.AsString();
// do your thing here
break;
}
Please note that Parameter.AsValueString() returns parameter value as a string with units, like the user would see it.
https://www.revitapidocs.com/2020/5015755d-ee80-9d74-68d9-55effc60ed0c.htm
https://thebuildingcoder.typepad.com/blog/2019/04/batch-processing-and-aspects-of-asstringvalue.html...
Hitting Accepted Answer is a Community Contribution from me as well as from you.
======================================================================