Esempio n. 1
0
        public void BrickDimsColour(UIDocument uidoc)
        {
            //filtered element collector dimensions in active view


            Transaction transaction = new Transaction(uidoc.Document);

            transaction.Start("Colour Dims By Brick Dim");

            List <Element> linearDimensions = new FilteredElementCollector(uidoc.Document, uidoc.Document.ActiveView.Id).OfCategory(BuiltInCategory.OST_Dimensions).ToList();

            if (linearDimensions.Count == 0)
            {
                TaskDialog.Show("fail", "oops that didn't work, perhaps try another view? or adding a dimension?");
            }

            //List<Element> linearDimensions = new FilteredElementCollector(uidoc.Document).ToList();

            //create lists of dimensions
            foreach (Dimension dim in linearDimensions)
            {
                DimClrChecker.DimClrChngSuffix(dim, uidoc);
            }
            //mainDialog.MainInstruction = sb.ToString();
            //TaskDialogResult tResult = mainDialog.Show();

            transaction.Commit();
        }
Esempio n. 2
0
        /// <summary>
        /// Colour Code Dimensions
        /// </summary>
        public void Execute(UpdaterData data)
        {
            Debug.Print("execute");
            if (m_updateActive == false)
            {
                return;
            }
            // Get access to document object
            Document   doc   = data.GetDocument();
            UIDocument uidoc = new UIDocument(doc);

            //using (Transaction t = new Transaction(doc, "Update Dim"))
            //{
            //   t.Start();
            try
            {
                Debug.Print("try");
                switch (caseswitch)
                {
                case 1:
                    // Loop through all the modified elements
                    ICollection <ElementId> modifiedCollection = data.GetModifiedElementIds();
                    foreach (ElementId elemId in modifiedCollection)
                    {
                        Dimension dim = doc.GetElement(elemId) as Dimension;
                        DimClrChecker.DimClrChngSuffix(dim, uidoc);
                        Debug.Print("changeClrSuffix");
                    }
                    caseswitch = 2;
                    Debug.Print("case2");
                    break;

                case 2:

                    caseswitch = 1;
                    Debug.Print("case1");
                    break;
                }
            }
            catch //(Exception ex)
            {
            }

            //t.Commit();
            //}
        }