コード例 #1
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));
 }
コード例 #2
0
ファイル: AreaLoadOnSlabList.cs プロジェクト: coyove/Luavit
        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));
        }
コード例 #3
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));
        }
コード例 #4
0
ファイル: EnumeratorList.cs プロジェクト: coyove/Luavit
        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);
                }
            }
        }
コード例 #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));
 }
コード例 #6
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)));
 }
コード例 #7
0
ファイル: WindowWallList.cs プロジェクト: coyove/Luavit
        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));
        }
コード例 #8
0
ファイル: RoomTagsList.cs プロジェクト: coyove/Luavit
        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));
        }
コード例 #9
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);
        }
コード例 #10
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);
        }
コード例 #11
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]));
 }
コード例 #12
0
ファイル: CategoriesList.cs プロジェクト: coyove/Luavit
        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);
        }
コード例 #13
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);
        }
コード例 #14
0
ファイル: CategoriesList.cs プロジェクト: coyove/Luavit
        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);
                }
            }
        }
コード例 #15
0
ファイル: CategoriesList.cs プロジェクト: coyove/Luavit
 public override void ExportToDataTable(DataTable dataTable)
 {
     if (dataTable == null)
     {
         return;
     }
     base.DataTable = dataTable;
     foreach (Category category in this.m_categories)
     {
         if (category != null)
         {
             string text;
             CategoriesList.TryGetName(category, out text);
             DataRow dataRow = this.GetDataRow(category);
             if (dataRow == null)
             {
                 dataRow = dataTable.NewRow();
                 Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Id"), category.Id.IntegerValue);
                 dataTable.Rows.Add(dataRow);
             }
             if (text == null)
             {
                 Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Name"), System.DBNull.Value);
             }
             else
             {
                 Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Name"), text);
             }
             if (category.Material != null)
             {
                 Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_MaterialId"), category.Material.Id.IntegerValue);
             }
             else
             {
                 Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_MaterialId"), System.DBNull.Value);
             }
         }
     }
 }
コード例 #16
0
        public override void ExportToDataTable(DataTable dataTable)
        {
            if (dataTable == null)
            {
                return;
            }
            base.DataTable = dataTable;
            string  @string = RDBResource.GetString("ExportedDrawing");
            DataRow dataRow = this.GetDataRow(@string);

            if (dataRow == null)
            {
                dataRow = dataTable.NewRow();
                dataTable.Rows.Add(dataRow);
                Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Name"), @string);
            }
            string a = dataRow[APIObjectList.ColumnRes("ColN_CST_Value")] as string;

            if (a != APIObjectList.ActiveDocument.PathName)
            {
                Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Value"), APIObjectList.ActiveDocument.PathName);
            }
        }
コード例 #17
0
        public override void ExportToDataTable(DataTable dataTable)
        {
            if (dataTable == null)
            {
                return;
            }
            base.DataTable = dataTable;
            ElementList elementList = base.TableInfo.ObjectList as ElementList;

            foreach (Element element in elementList.Elements)
            {
                Document document = element.Document;
                bool[]   array    = new bool[]
                {
                    default(bool),
                    true
                };
                for (int i = 0; i < array.Length; i++)
                {
                    bool flag = array[i];
                    if (!flag || element is HostObject)
                    {
                        System.Collections.Generic.ICollection <ElementId> materials = MaterialQuantitiesList.GetMaterials(element, flag);
                        if (materials != null && materials.Count > 0)
                        {
                            foreach (ElementId current in materials)
                            {
                                if (current.IntegerValue != ElementId.InvalidElementId.IntegerValue && document.GetElement(current) is Material)
                                {
                                    try
                                    {
                                        double  materialArea = element.GetMaterialArea(current, flag);
                                        double  num          = flag ? 0.0 : element.GetMaterialVolume(current);
                                        DataRow dataRow      = this.GetDataRow(new object[]
                                        {
                                            element.Id.IntegerValue,
                                            current.IntegerValue,
                                            flag
                                        });
                                        if (dataRow == null)
                                        {
                                            dataRow = dataTable.NewRow();
                                            Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_ElementId"), element.Id.IntegerValue);
                                            Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_MaterialId"), current.IntegerValue);
                                            Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_AsPaint"), flag);
                                            dataTable.Rows.Add(dataRow);
                                        }
                                        Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Area"), materialArea);
                                        Utility.Assign(dataRow, APIObjectList.ColumnRes("ColN_CST_Volume"), num);
                                    }
                                    catch (System.Exception arg)
                                    {
                                        Log.WriteWarning("Cannot get material id {0} of element {1}. " + arg, new object[]
                                        {
                                            current,
                                            element.Id
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #18
0
ファイル: SymbolList.cs プロジェクト: coyove/Luavit
        protected virtual Element CreateNewElement(DataRow row)
        {
            // *** Coyove Patched ***

            Element result;

            try
            {
                string text  = APIObjectList.ColumnRes((BuiltInParameter)(-1002002));
                string text2 = APIObjectList.ColumnRes((BuiltInParameter)(-1002001));
                string text3 = row[text].ToString();
                string text4 = row[text2].ToString();
                if (text3 == null || text4 == null || text3 == string.Empty || text4 == string.Empty)
                {
                    result = null;
                }
                else
                {
                    string arg = text4;
                    while (true)
                    {
                        string text5 = text4.Replace("'", "''");
                        string text6 = text3.Replace("'", "''");
                        // string filterExpression = string.Format("[{0}] = '{1}' and [{2}] = '{3}'", new object[]
                        string filterExpression = string.Format("\"{0}\" = '{1}' and \"{2}\" = '{3}'", new object[]
                        {
                            text,
                            text6,
                            text2,
                            text5
                        });
                        if (row.Table.Select(filterExpression).Length <= 1)
                        {
                            break;
                        }
                        text4 = arg + " " + this.m_numberSuffix;
                        Utility.Assign(row, text2, text4);
                        this.m_numberSuffix++;
                    }
                    Element element = null;
                    foreach (Element element2 in base.Elements)
                    {
                        if (element == null)
                        {
                            element = element2;
                        }
                        Parameter parameter = element2.get_Parameter((BuiltInParameter)(-1002002));
                        if (parameter != null && parameter.AsString().Equals(text3))
                        {
                            element = element2;
                            break;
                        }
                    }
                    if (element == null)
                    {
                        result = null;
                    }
                    else
                    {
                        ElementType elementType = element as ElementType;
                        Element     element3    = elementType.Duplicate(text4);
                        base.Elements.Insert(element3);
                        row[base.TableInfo[base.TableInfo.PrimaryKeys[0]].Name] = element3.Id.IntegerValue;
                        result = element3;
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }