查看标高类型参数的及设置值
UIDocument uiDoc = commandData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
FilteredElementCollector collector = new FilteredElementCollector(doc);
Element element = collector.OfClass(typeof(Level)).FirstElement();
Level level = element as Level;
LevelType levelType = doc.GetElement(level.GetTypeId()) as LevelType;
Parameter parameter = levelType.LookupParameter("基面");
//查看参数值
string baseLevel = "";
if (parameter.AsValueString() != null)
{
baseLevel = parameter.AsValueString();
}
else
{
baseLevel = parameter.AsString();
}
TaskDialog.Show("ParameterValue",baseLevel);
//设置参数值
using (Transaction trans = new Transaction(doc))
{
trans.Start("change the Parameter");
parameter.Set(0);//0:项目基点,1:测量点
trans.Commit();
}
TaskDialog.Show("ParameterValue", parameter.AsValueString());