public override sealed bool CastFrom(object source) { if (source is IGH_Goo goo) { source = goo.ScriptVariable(); } var categoryId = DB.ElementId.InvalidElementId; switch (source) { case DB.Category c: SetValue(c.Document(), c.Id); return(true); case DB.ElementId id: categoryId = id; break; case int integer: categoryId = new DB.ElementId(integer); break; } if (categoryId.IsCategoryId(Revit.ActiveDBDocument)) { SetValue(Revit.ActiveDBDocument, categoryId); return(true); } return(false); }
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 Category FromElementId(DB.Document doc, DB.ElementId id) { if (id.IsCategoryId(doc)) { return(new Category(doc, id)); } return(null); }
new public static ParameterKey FromElementId(DB.Document doc, DB.ElementId id) { if (id.IsParameterId(doc)) { return(new ParameterKey(doc, id)); } return(null); }
public Category(DB.Document doc, DB.ElementId id) : base(doc, id) { }
internal Element(DB.Document doc, DB.ElementId id) : base(doc, id) { }