예제 #1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp      = commandData.Application;
            UIDocument    uidoc      = uiapp.ActiveUIDocument;
            Application   app        = uiapp.Application;
            Document      doc        = uidoc.Document;
            HwndSource    hwndSource = HwndSource.FromHwnd(uiapp.MainWindowHandle);
            Window        wnd        = hwndSource.RootVisual as Window;

            try
            {
                string result = F_SetWidth.set_width(doc);
                if (result == "S")
                {
                    Transaction tr = new Transaction(doc);
                    tr.Start("SupportLayout");
                    UserControl1 viewWPF = new UserControl1(uiapp);
                    viewWPF.Owner = wnd;
                    viewWPF.Show();
                    tr.Commit();
                }
            }
            catch (Exception ex)
            {
                message = ex.ToString();
                return(Result.Failed);
            }
            return(Result.Succeeded);
        }
예제 #2
0
        public void Execute(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            try
            {
                F_SetWidth.set_width(doc);

                //Transaction transaction = new Transaction(doc);
                //transaction.Start("Width");

                //set_width(uiapp, doc);

                //transaction.Commit();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return;
        }
예제 #3
0
        public void Execute(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            try
            {
                Transaction transaction = new Transaction(doc);
                transaction.Start("Width");

                update_width(uiapp, doc);

                transaction.Commit();
                F_SetWidth.set_width(doc);
                List <ElementType> data_type = new FilteredElementCollector(doc).WhereElementIsElementType().Cast <ElementType>().ToList();
                F_GetWidth.get_width(my_width, data_width, data_type);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return;
        }