public static Result GetEByUCI(ExternalCommandData cData)
        {
            UIApplication uiApp = cData.Application;
            Document      doc   = cData.Application.ActiveUIDocument.Document;
            UIDocument    uidoc = uiApp.ActiveUIDocument;

            //Ask for a UCI input
            InputBoxBasic ds = new InputBoxBasic();

            ds.ShowDialog();

            Element element = doc.GetElement(ds.InputText);

            if (element == null)
            {
                return(Result.Failed);
            }
            List <ElementId> ids = new List <ElementId>(1);

            ids.Add(element.Id);

            Selection selection = uidoc.Selection;

            selection.SetElementIds(ids);

            return(Result.Succeeded);
        }
Example #2
0
        public static Result ElementCoordinatesPCF(ExternalCommandData cData)
        {
            UIApplication uiApp = cData.Application;
            Document      doc   = cData.Application.ActiveUIDocument.Document;
            UIDocument    uidoc = uiApp.ActiveUIDocument;

            Selection selection = uidoc.Selection;
            var       items     = selection.GetElementIds().Select(x => doc.GetElement(x));

            int decimals = 1;

            bool ctrl = false;

            if ((int)Keyboard.Modifiers == 2)
            {
                ctrl = true;
            }

            if (ctrl)
            {
                InputBoxBasic ds = new InputBoxBasic();
                ds.ShowDialog();
                decimals = int.Parse(ds.InputText);
            }

            string message = string.Empty;

            foreach (Element e in items)
            {
                message += e.Name + "\n";

                Cons cons = mp.GetConnectors(e);
                message += PCF_Functions.EndWriter.WriteEP1(cons.Primary, decimals);
                message += PCF_Functions.EndWriter.WriteEP1(cons.Secondary, decimals);
            }

            Shared.BuildingCoder.BuildingCoderUtilities.InfoMsg(message);

            return(Result.Succeeded);
        }