コード例 #1
0
        public Result OnStartup(UIControlledApplication application)
        {
            m_FormSectionBox     = null; // no dialog needed yet; the command will bring it
            m_FormSectionBoxList = null;
            thisApp = this;              // static access to this application instance

            return(Result.Succeeded);
        }
コード例 #2
0
        public void ShowFormCopy(UIApplication uiapp)
        {
            // If we do not have a dialog yet, create and show it
            if (m_FormSectionBoxList == null || m_FormSectionBoxList.IsDisposed)
            {
                // A new handler to handle request posting by the dialog
                ClassRequestHandler handler = new ClassRequestHandler();

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                // We give the objects to the new dialog;
                // The dialog becomes the owner responsible fore disposing them, eventually.
                m_FormSectionBoxList = new FormSectionBoxList(uiapp, exEvent, handler);
                //m_FormSectionBox = new FormSectionBox(exEvent, handler);
                m_FormSectionBoxList.Show();
            }
        }
コード例 #3
0
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            uiApp = commandData.Application;

            FormSectionBoxList fs = new FormSectionBoxList(commandData.Application, null, null);

            if (fs.ShowDialog() == DialogResult.OK)
            {
                if (uiApp.ActiveUIDocument.Document.ActiveView.ViewType != ViewType.ThreeD)
                {
                    TaskDialog.Show("提示", "只对3维视图有效", TaskDialogCommonButtons.Close);
                    return(Autodesk.Revit.UI.Result.Succeeded);
                }
                View3D         view3dActive = (View3D)uiApp.ActiveUIDocument.Document.ActiveView;
                BoundingBoxXYZ sectionBox   = view3dActive.GetSectionBox();

                using (Transaction trans = new Transaction(uiApp.ActiveUIDocument.Document))
                {
                    // The name of the transaction was given as an argument
                    if (trans.Start("sectionBox Copy") == TransactionStatus.Started)
                    {
                        // apply the requested operation to every door
                        //view3dActive.SetSectionBox();

                        trans.Commit();
                    }
                }
            }
            return(Autodesk.Revit.UI.Result.Succeeded);



            //try
            //{
            //    ClassApplication.thisApp.ShowFormCopy(commandData.Application);

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