예제 #1
0
        private bool AddParameters()
        {
            Document doc = m_app.ActiveUIDocument.Document;

            Autodesk.Revit.ApplicationServices.Application app = m_app.Application;
            ParameterAssigner pa = new ParameterAssigner(app, doc);

            MainWindow mw = new MainWindow();

            mw.ShowDialog();
            if (mw.DialogResult == true)
            {
                string filepath   = ParameterSettings.filePath;
                bool   isinstance = ParameterSettings.isInstance;

                Transaction t = new Transaction(doc, "Bind Shared Parameters");
                t.Start();
                bool succeeded = pa.BindSharedParameters(filepath, isinstance);
                if (succeeded)
                {
                    t.Commit();
                    return(true);
                }
                else
                {
                    t.RollBack();
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        private bool AddParameters()
        {
            Document doc = m_app.ActiveUIDocument.Document;
            Autodesk.Revit.ApplicationServices.Application app = m_app.Application;
            ParameterAssigner pa = new ParameterAssigner(app, doc);

            MainWindow mw = new MainWindow();
            mw.ShowDialog();
            if (mw.DialogResult == true)
            {
                string filepath = ParameterSettings.filePath;
                bool isinstance = ParameterSettings.isInstance;

                Transaction t = new Transaction(doc, "Bind Shared Parameters");
                t.Start();
                bool succeeded = pa.BindSharedParameters(filepath, isinstance);
                if (succeeded)
                {
                    t.Commit();
                    return true;
                }
                else
                {
                    t.RollBack();
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
예제 #3
0
        private bool AddParameters()
        {
            Document doc = m_app.ActiveUIDocument.Document;

            if (null == doc)
            {
                MessageBox.Show("There's no available document.");
                return(false);
            }

            if (!doc.IsFamilyDocument)
            {
                MessageBox.Show("The active document is not a family document.");
                return(false);
            }

            ParameterAssigner pa = new ParameterAssigner(m_app.Application, doc);
            // the parameters to be added are defined and recorded in a text file, read them from that file and load to memory
            bool succeeded = pa.LoadSharedParameterFile();

            if (!succeeded)
            {
                return(false);
            }

            Transaction t = new Transaction(doc, "Bind Shared Parameters");

            t.Start();
            succeeded = pa.BindSharedParameters();
            if (succeeded)
            {
                t.Commit();
                return(true);
            }
            else
            {
                t.RollBack();
                return(false);
            }
        }
예제 #4
0
        private bool AddParameters()
        {
            Document doc = m_app.ActiveUIDocument.Document;
              if (null == doc)
              {
            MessageBox.Show("There's no available document.");
            return false;
              }

              if (!doc.IsFamilyDocument)
              {
            MessageBox.Show("The active document is not a family document.");
            return false;
              }

              ParameterAssigner pa = new ParameterAssigner(m_app.Application, doc);
              // the parameters to be added are defined and recorded in a text file, read them from that file and load to memory
              bool succeeded = pa.LoadSharedParameterFile();
              if (!succeeded)
              {
            return false;
              }

              Transaction t = new Transaction(doc, "Bind Shared Parameters");
              t.Start();
              succeeded = pa.BindSharedParameters();
              if (succeeded)
              {
            t.Commit();
            return true;
              }
              else
              {
            t.RollBack();
            return false;
              }
        }