Example #1
0
        public void SetParameter(Parameter p, CegParameterInfo oldInfo, CegParameterInfo newInfo)
        {
            switch (oldInfo.Type)
            {
            case StorageType.Integer:
            {
                bool flag = oldInfo.AsInteger != newInfo.AsInteger;
                if (flag)
                {
                    p.Set(newInfo.AsInteger);
                }
                break;
            }

            case StorageType.Double:
            {
                bool flag2 = Math.Abs(oldInfo.AsDouble - newInfo.AsDouble) > 0.001;
                if (flag2)
                {
                    p.Set(newInfo.AsDouble);
                }
                break;
            }

            case StorageType.String:
            {
                bool flag3 = oldInfo.AsString != newInfo.AsString;
                if (flag3)
                {
                    p.Set(newInfo.AsString);
                }
                break;
            }
            }
        }
        //lay parameter va value
        public CegParameterSet GetParameter(Document doc, FamilyInstance Titleblock)
        {
            CegParameterSet cegParameterSet = new CegParameterSet();

            if (doc.ActiveView.IsViewSheet())
            {
                ViewSheet viewSheet = doc.ActiveView as ViewSheet;
                string    sheetName = GetSheetName(viewSheet);
                foreach (object obj in viewSheet.Parameters)
                {
                    Parameter parameter  = (Parameter)obj;
                    bool      isReadOnly = parameter.IsReadOnly;
                    if (!isReadOnly)
                    {
                        string           name  = parameter.Definition.Name;
                        CegParameterInfo value = new CegParameterInfo(parameter);
                        cegParameterSet.Parameters[name] = value;
                    }
                }
            }
            return(cegParameterSet);
        }