コード例 #1
0
ファイル: SetType.cs プロジェクト: chuongmep/Revit_Toolkit
        /***************************************************/

        public static bool SetType(this Element element, IInstance instance, RevitSettings settings)
        {
            if (element.TrySetTypeFromString(instance, settings))
            {
                return(true);
            }

            ElementType elementType = instance.Properties.ElementType(element.Document, settings);

            if (elementType == null)
            {
                elementType = instance.IElementType(element.Document, settings);
            }

            if (elementType != null)
            {
                try
                {
                    return(element.SetParameter(BuiltInParameter.ELEM_TYPE_PARAM, elementType.Id));
                }
                catch
                {
                }
            }

            return(false);
        }