Ejemplo n.º 1
0
 protected override void PopulateDbRow(Element element, DataRow row)
 {
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_ElementId"), APIObjectList.GetIdDbValue(element));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_ElementName"), APIObjectList.GetNameDbValue(element));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_PhaseCreatedId"), APIObjectList.GetIdDbValue(element.CreatedPhaseId));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_PhaseName"), APIObjectList.GetNameDbValue(element.Document.GetElement(element.CreatedPhaseId)));
 }
Ejemplo n.º 2
0
 public override void InitializeList()
 {
     Category[] categorys = (from c in APIObjectList.ActiveDocument.Settings.Categories.OfType <Category>()
                             where c != null && c.HasMaterialQuantities
                             select c).ToArray <Category>();
     base.AddRange(APIObjectList.GetElements(false, categorys));
 }
Ejemplo n.º 3
0
        protected override void PopulateDbRow(Element element, DataRow row)
        {
            AreaLoad areaLoad = element as AreaLoad;

            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_AreaLoadId"), APIObjectList.GetIdDbValue(areaLoad));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_SlabId"), APIObjectList.GetIdDbValue(areaLoad.HostElement));
        }
Ejemplo n.º 4
0
        protected override void PopulateDbRow(Element element, DataRow row)
        {
            LineLoad lineLoad = element as LineLoad;

            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_LineLoadId"), APIObjectList.GetIdDbValue(lineLoad));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_BeamId"), APIObjectList.GetIdDbValue(lineLoad.HostElement));
        }
Ejemplo n.º 5
0
 protected override void PopulateDbRow(Element element, DataRow row)
 {
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_Id"), APIObjectList.GetIdDbValue(element));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_Name"), APIObjectList.GetNameDbValue(element));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_LevelId"), APIObjectList.GetIdDbValue(element.LevelId));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_HostId"), APIObjectList.GetIdDbValue((element as Opening).Host));
 }
Ejemplo n.º 6
0
        public override void ExportToDataTable(DataTable dataTable)
        {
            if (dataTable == null)
            {
                return;
            }
            base.DataTable = dataTable;
            EnumeratorTableInfo arg_16_0 = (EnumeratorTableInfo)base.TableInfo;

            System.Type enumType = this.EnumType;
            foreach (object current in System.Enum.GetValues(enumType))
            {
                DataRow dataRow = this.GetDataRow(current);
                if (dataRow == null)
                {
                    dataRow = dataTable.NewRow();
                    dataTable.Rows.Add(dataRow);
                    Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_EnumIndex"), (int)current);
                }
                string text = current.ToString();
                string a    = dataRow[APIObjectList.ColumnRes("ColN_CST_EnumName")] as string;
                if (a != text)
                {
                    Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_EnumName"), text);
                }
            }
        }
Ejemplo n.º 7
0
 protected void SetDbRowIDAndHostId(Element element, Element host, DataRow dataRow)
 {
     Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Id"), APIObjectList.GetIdDbValue(element));
     Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Name"), APIObjectList.GetNameDbValue(element));
     Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_HostId"), APIObjectList.GetIdDbValue(host));
     Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_HostName"), APIObjectList.GetNameDbValue(host));
 }
Ejemplo n.º 8
0
        public override object GetRevitObject(DataRow dataRow)
        {
            ColumnInfo columnInfo = base.TableInfo[base.TableInfo.PrimaryKeys[0]];
            int        id         = System.Convert.ToInt32(dataRow[columnInfo.Name]);

            return(APIObjectList.GetElementById(id));
        }
Ejemplo n.º 9
0
 public override void InitializeList()
 {
     base.AddRange(APIObjectList.GetElements(false, new BuiltInCategory[]
     {
         this.m_category
     }));
 }
Ejemplo n.º 10
0
 public SymbolTableInfoWithDefaults(string tableId, APIObjectList objectList) : base(tableId, objectList)
 {
     base.WithColumn((BuiltInParameter)(-1002100), DataType.INTEGER).WithColumn((BuiltInParameter)(-1140422), DataType.TEXT).WithColumn((BuiltInParameter)(-1010109), DataType.TEXT).WithColumn((BuiltInParameter)(-1010108), DataType.TEXT).WithColumn((BuiltInParameter)(-1010105), DataType.TEXT).WithColumn((BuiltInParameter)(-1010104), DataType.TEXT).WithColumn((BuiltInParameter)(-1010103), DataType.TEXT).WithColumn((BuiltInParameter)(-1002502), DataType.TEXT).WithColumn((BuiltInParameter)(-1002500), DataType.TEXT).WithColumn((BuiltInParameter)(-1002002), DataType.TEXT).WithDisplayColumn((BuiltInParameter)(-1002001), DataType.TEXT).WithColumn((BuiltInParameter)(-1001405), DataType.TEXT).WithColumn((BuiltInParameter)(-1001205), DataType.DOUBLE).WithPrimaryKey((BuiltInParameter)(-1002100)).WithForeignKey((BuiltInParameter)(-1002500), "TabN_CST_AssemblyCodes", (BuiltInParameter)(-1002500));
     if (OmniClassNumbersList.OmniClassNumberFileExist)
     {
         base.WithForeignKey((BuiltInParameter)(-1002502), "TabN_CST_OmniClassNumbers", (BuiltInParameter)(-1002502));
     }
 }
Ejemplo n.º 11
0
 public override void InitializeList()
 {
     base.AddRange(from lineLoad in base.GetElementsByCategory <LineLoad>(new BuiltInCategory[]
     {
         (BuiltInCategory)(-2005202)
     })
                   where APIObjectList.GetCategoryId(lineLoad.HostElement) == (BuiltInCategory)(-2001320)
                   select lineLoad);
 }
Ejemplo n.º 12
0
        protected override void PopulateDbRow(Element element, DataRow row)
        {
            FamilyInstance familyInstance = element as FamilyInstance;

            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_WindowId"), APIObjectList.GetIdDbValue(element));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_WindowName"), APIObjectList.GetNameDbValue(element));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_WallId"), APIObjectList.GetIdDbValue(familyInstance.Host));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_WallName"), APIObjectList.GetNameDbValue(familyInstance.Host));
        }
Ejemplo n.º 13
0
 public static BuiltInCategory GetCategoryId(ElementId elementId, Document doc)
 {
     if (elementId != ElementId.InvalidElementId && doc != null)
     {
         Element element = doc.GetElement(elementId);
         return(APIObjectList.GetCategoryId(element));
     }
     return((BuiltInCategory)(-1));
 }
Ejemplo n.º 14
0
        protected override void PopulateDbRow(Element element, DataRow row)
        {
            RoomTag roomTag = element as RoomTag;

            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_Id"), APIObjectList.GetIdDbValue(roomTag));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_RoomTagType"), APIObjectList.GetNameDbValue(APIObjectList.GetElementById(roomTag.GetTypeId())));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_RoomId"), APIObjectList.GetIdDbValue(roomTag.Room));
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_ViewId"), APIObjectList.GetIdDbValue(roomTag.View));
        }
Ejemplo n.º 15
0
 public override void InitializeList()
 {
     base.AddRange(from fi in base.GetFamilyInstance(new BuiltInCategory[]
     {
         (BuiltInCategory)(-2000151)
     })
                   where APIObjectList.GetCategoryId(fi.Host) == (BuiltInCategory)(-2000035)
                   select fi);
 }
Ejemplo n.º 16
0
        protected static object GetIdDbValue(Element element)
        {
            int elementId = APIObjectList.GetElementId(element);

            if (elementId == -1)
            {
                return(System.DBNull.Value);
            }
            return(elementId);
        }
Ejemplo n.º 17
0
 public override void InitializeList()
 {
     base.AddRange(from panel in base.GetElementsByCategory <Panel>(new BuiltInCategory[]
     {
         (BuiltInCategory)(-2000170)
     })
                   let panelInstance = panel
                                       where APIObjectList.GetCategoryId(panelInstance.Host) == (BuiltInCategory)(-2000035)
                                       select panelInstance);
 }
Ejemplo n.º 18
0
 public TableInfo(BuiltInCategory builtInCategory, ElementTypeEnum instanceOrSymbol, APIObjectList list) : this(string.Concat(new object[]
 {
     "TabN_",
     builtInCategory,
     "_",
     instanceOrSymbol
 }))
 {
     this.m_objectList = list;
     list.TableInfo    = this;
 }
Ejemplo n.º 19
0
        public override object GetRevitObject(DataRow dataRow)
        {
            int id = System.Convert.ToInt32(dataRow[APIObjectList.ColumnRes(base.TableInfo.PrimaryKeys[0])]);

            System.Convert.ToInt32(dataRow[APIObjectList.ColumnRes(base.TableInfo.PrimaryKeys[1])]);
            if (!(APIObjectList.GetElementById(id) is FamilyInstance))
            {
                return(null);
            }
            return(dataRow.ItemArray);
        }
Ejemplo n.º 20
0
 public override void InitializeList()
 {
     base.AddRange(base.GetElementsByCategory(new BuiltInCategory[]
     {
         (BuiltInCategory)(-2000999),
         (BuiltInCategory)(-2000997)
     }).Where(delegate(Element e)
     {
         Opening opening = e as Opening;
         return(opening != null && APIObjectList.GetCategoryId(opening.Host) == (BuiltInCategory)(-2000011));
     }));
 }
Ejemplo n.º 21
0
        private void InsertDbRow(string code, string description)
        {
            DataRow dataRow = this.GetDataRow(code);

            if (dataRow == null)
            {
                dataRow = base.DataTable.NewRow();
                Utility.Assign(dataRow, APIObjectList.ColumnRes((BuiltInParameter)(-1002502)), code);
                base.DataTable.Rows.Add(dataRow);
            }
            Utility.Assign(dataRow, APIObjectList.ColumnRes((BuiltInParameter)(-1002503)), description);
        }
Ejemplo n.º 22
0
 protected override void PopulateDbRow(object element, DataRow row)
 {
     object[] array = element as object[];
     if (array == null || array.Length < 5)
     {
         return;
     }
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_Id"), array[0]);
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_PhaseId"), array[1]);
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_DesignOptionId"), array[2]);
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_FromRoom"), APIObjectList.GetIdDbValue((int)array[3]));
     Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_ToRoom"), APIObjectList.GetIdDbValue((int)array[4]));
 }
Ejemplo n.º 23
0
        private ErrorRow UpdateOneElement(Element elem, DataRow row)
        {
            ErrorRow     errorRow     = new ErrorRow(row);
            ParameterMap parameterMap = null;

            try
            {
                parameterMap = elem.ParametersMap;
            }
            catch (System.Exception ex)
            {
                Log.WriteLine(string.Concat(new object[]
                {
                    "TableName:",
                    base.TableInfo.Name,
                    " ElementId:",
                    elem.Id.IntegerValue
                }));
                Log.WriteLine(ex.ToString());
            }
            foreach (ColumnInfo current in base.TableInfo.Values)
            {
                Parameter param;
                if (current.BuiltInParameter != (BuiltInParameter)(-1))
                {
                    param = elem.get_Parameter(current.BuiltInParameter);
                }
                else
                {
                    param = APIObjectList.GetParameterByDefinitionName(parameterMap, current.Name);
                }
                object       paramValue = row[current.Name];
                UpdateResult state      = (current.BuiltInParameter == (BuiltInParameter)(-1002500)) ? UpdateResult.AssemblyCode : this.UpdateParameter(param, paramValue);
                ErrorCell    value      = new ErrorCell(current.Name, state);
                errorRow.Cells.Add(current.Name, value);
                switch (state)
                {
                case UpdateResult.Unknown:
                case UpdateResult.Success:
                case UpdateResult.Failed:
                case UpdateResult.ReadOnlyFailed:
                case UpdateResult.ParameterNull:
                case UpdateResult.Exception:
                    errorRow.HasChange = true;
                    break;
                }
            }
            return(errorRow);
        }
Ejemplo n.º 24
0
        public override object GetRevitObject(DataRow dataRow)
        {
            string text = (string)dataRow[APIObjectList.ColumnRes("ColN_CST_Name")];
            object result;

            try
            {
                result = this.m_categories.get_Item(text);
            }
            catch (System.Exception)
            {
                result = null;
            }
            return(result);
        }
Ejemplo n.º 25
0
        private object CreateListItem(FamilyInstance familyInstance, Phase phase)
        {
            SpatialElement spatialElement = this.GetSpatialElement(familyInstance, phase);

            if (spatialElement != null)
            {
                return(new object[]
                {
                    familyInstance.Id.IntegerValue,
                    phase.Id.IntegerValue,
                    spatialElement.Id.IntegerValue,
                    APIObjectList.GetElementId(familyInstance.DesignOption)
                });
            }
            return(null);
        }
Ejemplo n.º 26
0
        protected override object[] GetPrimaryKeyValues(object apiObject)
        {
            Element element = apiObject as Element;

            if (element != null)
            {
                return(new object[]
                {
                    APIObjectList.GetIdDbValue(element)
                });
            }
            return(new object[]
            {
                System.DBNull.Value
            });
        }
Ejemplo n.º 27
0
        private static void TestUnitConversion(Parameter parameter, double retval)
        {
            double num  = 0.01;
            double num2 = double.NaN;
            string text = parameter.AsValueString();

            if (text.Contains("\"") || text.Contains("'"))
            {
                string text2 = parameter.DisplayUnitType.ToString();
                if (text2.Contains("FEET") || text2.Contains("INCHE"))
                {
                    num2 = APIObjectList.ConvertImperial(text);
                }
            }
            else
            {
                Regex  regex = new Regex("-?\\d+(\\.\\d+)?");
                string value = regex.Match(parameter.AsValueString()).Groups[0].Value;
                try
                {
                    num2 = double.Parse(value);
                }
                catch (System.Exception ex)
                {
                    Log.WriteWarning("1. RetVal={1} ValueString={0}, RegexInput={2}, DUT={3}, Exception={4}", new object[]
                    {
                        parameter.AsValueString(),
                        retval,
                        text,
                        parameter.DisplayUnitType,
                        ex.Message
                    });
                }
            }
            if (System.Math.Abs(num2 - retval) > num)
            {
                Log.WriteWarning("Unit conversion failure: RetVal={0} ApiValue={1} ValueString={2}, calculated={3}, DUT={4}, Parameter={5}", new object[]
                {
                    retval,
                    parameter.AsDouble(),
                    parameter.AsValueString(),
                    num2,
                    parameter.DisplayUnitType,
                    parameter.Definition.Name
                });
            }
        }
Ejemplo n.º 28
0
        protected override void PopulateDbRow(object element, DataRow row)
        {
            object[] array = element as object[];
            if (array == null || array.Length < 4)
            {
                return;
            }
            int num  = (int)array[0];
            int num2 = (int)array[1];
            int num3 = (int)array[2];
            int num4 = (int)array[3];

            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_Id"), num);
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_PhaseId"), num2);
            Utility.Assign(row, APIObjectList.ColumnRes("ColN_CST_DesignOptionId"), num4);
            Utility.Assign(row, APIObjectList.ColumnRes(this.GetSpatialElementColumnKey()), num3);
        }
Ejemplo n.º 29
0
        public override void ClearUpdatedOrAddedRecords()
        {
            if (base.DataTable == null)
            {
                return;
            }
            DataRowCollection rows = base.DataTable.Rows;

            for (int i = rows.Count - 1; i >= 0; i--)
            {
                object obj = rows[i][APIObjectList.ColumnRes("ColN_CST_Id")];
                if (obj != null && this.GetRevitObject(rows[i]) != null)
                {
                    base.DataTable.Rows.RemoveAt(i);
                }
            }
        }
Ejemplo n.º 30
0
        private object CreateListItem(FamilyInstance familyInstance, Phase phase)
        {
            Room toRoom   = this.GetToRoom(familyInstance, phase);
            Room fromRoom = this.GetFromRoom(familyInstance, phase);

            if (toRoom != null || fromRoom != null)
            {
                return(new object[]
                {
                    familyInstance.Id.IntegerValue,
                    phase.Id.IntegerValue,
                    APIObjectList.GetElementId(familyInstance.DesignOption),
                    APIObjectList.GetElementId(fromRoom),
                    APIObjectList.GetElementId(toRoom)
                });
            }
            return(null);
        }