public override sealed bool CastFrom(object source) { if (source is IGH_Goo goo) { source = goo.ScriptVariable(); } var parameterId = DB.ElementId.InvalidElementId; switch (source) { case DB.ParameterElement parameterElement: SetValue(parameterElement.Document, parameterElement.Id); return(true); case DB.Parameter parameter: SetValue(parameter.Element.Document, parameter.Id); return(true); case DB.ElementId id: parameterId = id; break; case int integer: parameterId = new DB.ElementId(integer); break; } if (parameterId.IsParameterId(Revit.ActiveDBDocument)) { SetValue(Revit.ActiveDBDocument, parameterId); return(true); } return(base.CastFrom(source)); }
new public static ParameterKey FromElementId(DB.Document doc, DB.ElementId id) { if (id.IsParameterId(doc)) { return(new ParameterKey(doc, id)); } return(null); }