Пример #1
0
        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);
        }
Пример #2
0
        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));
        }
Пример #3
0
        new public static Category FromElementId(DB.Document doc, DB.ElementId id)
        {
            if (id.IsCategoryId(doc))
            {
                return(new Category(doc, id));
            }

            return(null);
        }
Пример #4
0
        new public static ParameterKey FromElementId(DB.Document doc, DB.ElementId id)
        {
            if (id.IsParameterId(doc))
            {
                return(new ParameterKey(doc, id));
            }

            return(null);
        }
Пример #5
0
 public Category(DB.Document doc, DB.ElementId id) : base(doc, id)
 {
 }
Пример #6
0
 internal Element(DB.Document doc, DB.ElementId id) : base(doc, id)
 {
 }