private void App_Changed(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
        {
            Document doc = e.GetDocument();

            ICollection <ElementId> elementIds = new FilteredElementCollector(doc).WhereElementIsNotElementType().ToElementIds();

            foreach (var eid in elementIds)
            {
                Element ele = doc.GetElement(eid);

                if (ele.Category != null && ele.Category.Name != null)
                {
                    try
                    {
                        int    elementIdKey    = eid.IntegerValue;
                        string keyCategoryName = doc.GetElement(eid).Category.Name;

                        dictionaryDB.Add(elementIdKey, keyCategoryName);

                        //System.IO.File.AppendAllText(@"C:\Temp\RevitDB.txt", String.Format("{0} : {1}\n",elementIdKey, keyCategoryName));
                    }
                    catch
                    {
                    }
                }
            }

            m_MyDock.labelCount2.Text = elementIds.Count.ToString();
        }
Esempio n. 2
0
        /// <summary>
        /// On document change, update Family Parameters
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void c_app_DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
        {
            if (!Started)
            {
                return;            // only do if the plugin is active
            }
            List <string> commands = new List <string>()
            {
                "param",
                "Modify element attributes",
                "Family Types",
                "Add Parameter",
                "Delete Selection",
                "Delete Parameter",
                "Parameter Delete",
                "Parameter Change",
                "Change Parameter Name",
                "Project Units"
            };

            if (_presenter != null && _presenter._enabled)
            {
                IList <String> operations = e.GetTransactionNames();
                if (commands.Any(operations.Contains))
                {
                    _presenter.ThisDocumentChanged();
                }
            }
        }
Esempio n. 3
0
 //On document change, update Family Parameters
 private void c_app_DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
 {
     if (!Started)
     {
         return;            // only do if the plugin is active
     }
     Control.DocumentChanged(e);
 }