- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
cannot retrieve omniclass number (Revit 2017).
My Code :
public RenderNodeAction OnElementBegin(ElementId elementId)
{
Element El = _StackDoc.Peek().GetElement(elementId);
BuiltInParameter _bipCode = BuiltInParameter.OMNICLASS_CODE;
BuiltInParameter _bipDesc = BuiltInParameter.OMNICLASS_DESCRIPTION;
String CatS = "Show Standard parameters in selected " + CTCT + ":\n";
foreach (Parameter para in El.Parameters)
{
string defName = para.Definition.Name + " = ";
// Use different method to get parameter data according to the storage type
switch (para.StorageType)
{
case StorageType.Double:
//covert the number into Metric
defName += para.AsValueString();
Double Test = para.AsDouble() * 25.4;
String TESTS = Test.ToString();
break;
case StorageType.ElementId:
//find out the name of the element
ElementId id = para.AsElementId();
if (id.IntegerValue >= 0)
{
defName += _StackDoc.Peek().GetElement(id).Name;
}
else
{
defName += id.IntegerValue.ToString();
}
break;
case StorageType.Integer:
if (ParameterType.YesNo == para.Definition.ParameterType)
{
if (para.AsInteger() == 0)
{
defName += "False";
}
else
{
defName += "True";
}
}
else
{
defName += para.AsInteger().ToString();
}
break;
case StorageType.String:
defName += para.AsString();
break;
default:
defName = "Unexposed parameter.";
break;
}
CatS = CatS + defName + "\n";
}
String OmiClass = "";
if (El.get_Parameter(_bipCode) != null)
OmiClass = "<" + El.get_Parameter(_bipCode).AsString() + ">";
else
OmiClass = "<>";
if (El.get_Parameter(_bipDesc) != null)
OmiClass = OmiClass + "<" + El.get_Parameter(_bipDesc).AsString() + ">";
else
OmiClass = OmiClass + "<>";
TaskDialog.Show("Debug", CatS + "\n\n OmiClass = " + OmiClass);
return RenderNodeAction.Proceed;
}
My Rvt Model and Result on Windowns (in attachment).
Philippe.
Solved! Go to Solution.