コード例 #1
0
        /// <summary>
        /// Create and Show new ElementEditorForm
        /// </summary>
        /// <param name="commandData"></param>
        public void CreateForm(ExternalCommandData commandData)
        {
            // create ExternalEventHandler for Edit parameters
            ParaEditEventHandler handler       = new ParaEditEventHandler();
            ExternalEvent        paraEditEvent = ExternalEvent.Create(handler);

            handler.ParaEditEvent = paraEditEvent;

            // create element editor form
            elementEditorForm = new ElementEditorForm(commandData, handler);

            handler.ElementEditorForm = elementEditorForm;

            elementEditorForm.Show();
        }
コード例 #2
0
        /// <summary>
        /// Create Revit UI elements for Element Editor on start up
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            thisApp           = this;
            elementEditorForm = null;

            // set up panel
            RibbonPanel elePreviewPanel = application.CreateRibbonPanel("Element Editor");

            // get assembly path
            string assemblyPath = Assembly.GetExecutingAssembly().Location;

            // create pushbutton
            PushButtonData elePreviewButtonData = new PushButtonData("cmdEleEditor", "Element Editor", assemblyPath, "ElementEditorAddIn.ElementEditorOpenForm");
            PushButton     elePreviewButton     = elePreviewPanel.AddItem(elePreviewButtonData) as PushButton;

            // Get picture for the pushbutton
            Uri         uriImage1   = new Uri(@"C:\Users\labuser\Pictures\test32x32.png");
            BitmapImage buttonImage = new BitmapImage(uriImage1);

            elePreviewButton.LargeImage = buttonImage;

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