예제 #1
0
        /// <summary>
        /// Command Entry Point
        /// </summary>
        /// <param name="commandData">Input argument providing access to the Revit application and documents</param>
        /// <param name="message">Return message to the user in case of error or cancel</param>
        /// <param name="elements">Return argument to highlight elements on the graphics screen if Result is not Succeeded.</param>
        /// <returns>Cancelled, Failed or Succeeded</returns>
        public Result Execute(ExternalCommandData commandData,
                              ref string message,
                              ElementSet elements)
        {
            try
            {
                // Version
                if (!commandData.Application.Application.VersionName.Contains("2018"))
                {
                    message = "This Add-In was built for Revit 2018, please contact CASE for assistance...";
                    return(Result.Failed);
                }

                // Construct and Display the form
                form_Main frm = new form_Main(commandData);
                frm.ShowDialog();

                // Return Success
                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                // Failure Message
                message = ex.Message;
                return(Result.Failed);
            }
        }
예제 #2
0
        private void Main_Window_Load(object sender, EventArgs e)
        {
            Model Model = Model.Instance;
            //Load Main form as child.
            Form f = new form_Main(Model);

            f.MdiParent = this;
            f.Show();
        }
예제 #3
0
        /// <summary>
        /// Report Groups by View
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                // Version
                if (!commandData.Application.Application.VersionName.Contains("2020"))
                {
                    // Failure
                    using (TaskDialog td = new TaskDialog("Cannot Continue"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "Incompatible Version of Revit";
                        td.MainContent     = "This Add-In was built for Revit 2020, please contact CASE for assistance.";
                        td.Show();
                    }
                    return(Result.Cancelled);
                }

                // Settings
                clsSettings m_s = new clsSettings(commandData);
                if (m_s.ModelGroups.Count + m_s.DetailGroups.Count < 1)
                {
                    using (TaskDialog td = new TaskDialog("No Groups Found"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "No Groups Found";
                        td.Show();
                    }
                    return(Result.Cancelled);
                }

                // Form
                using (form_Main d = new form_Main(m_s))
                {
                    d.ShowDialog();
                }

                // Success
                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                // Failure
                message = ex.Message;
                return(Result.Failed);
            }
        }
예제 #4
0
        /// <summary>
        /// Command Entry Point
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                // Document
                Document m_doc = commandData.Application.ActiveUIDocument.Document;

                // Session Guid
                string m_guid = Guid.NewGuid().ToString();

                //// New Schedules
                //List<ViewSchedule> m_schedules = new List<ViewSchedule>();

                //// Project Information
                //// Wires
                //// Roads
                //// Rebar Shape
                //// Areas
                //// Materials
                //// Shaft Openings
                //// Views
                //// Sheets

                //// Start a New Transaction
                //using (Transaction t = new Transaction(m_doc))
                //{
                //  if (t.Start("Not Saved") == TransactionStatus.Started)
                //  {

                //    try
                //    {

                //      // Find Categories that Support Custom Parameter Bindings
                //      foreach (Category x in m_doc.Settings.Categories)
                //      {
                //        if (x.AllowsBoundParameters)
                //        {

                //          try
                //          {
                //            // New Schedule
                //            ViewSchedule m_vs = ViewSchedule.CreateSchedule(m_doc, x.Id);
                //            m_vs.Name = x.Name;
                //            m_schedules.Add(m_vs);

                //            if (x.Id.IntegerValue == (int)BuiltInCategory.OST_Rooms)
                //            {

                //              foreach (SchedulableField sf in m_vs.Definition.GetSchedulableFields())
                //              {



                //                m_vs.Definition.AddField(sf);

                //                //// Shared Parameters will have a Positive ID
                //                //if (sf.ParameterId.IntegerValue > 0)
                //                //{
                //                //  Element m_elem = m_doc.GetElement(sf.ParameterId);
                //                //}

                //              }

                //            }

                //          }
                //          catch { }

                //        }

                //      }

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

                //    }
                //    catch { }
                //  }
                //}



                // Show the Progressbar Form
                form_Main m_dlg = new form_Main(m_doc.ParameterBindings.Size + 1);
                m_dlg.Show();

                BindingMap m_map = m_doc.ParameterBindings;

                try
                {
                    // Iterate
                    DefinitionBindingMapIterator m_iter = m_map.ForwardIterator();
                    while (m_iter.MoveNext())
                    {
                        ElementBinding m_eb  = m_iter.Current as ElementBinding;
                        Definition     m_def = m_iter.Key;

                        try
                        {
                            ExternalDefinition m_extDev = m_def as ExternalDefinition;
                            if (m_extDev != null)
                            {
                                string m_todo = string.Empty;
                            }
                        }
                        catch { }


                        //if (m_eb != null)
                        //{
                        //  CategorySet m_set = m_eb.Categories;
                        //}
                    }
                }
                catch { }

                // Success
                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                // Failure
                message = ex.Message;
                return(Result.Failed);
            }
        }