Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to return control to revit?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
424 Views, 1 Reply

How to return control to revit?

       I have create one dockablePane using the interface:Page, IDockablePaneProvider.In this pane,I want to add one button .when click the button,my plugin can drive the Api to do some modify to the model,such as translation,rotation or delete element.So I create an IexternalEventHandle,and implement its  Execute method with my modify logic.And create an ExternalEvent when the dockablePane is create.In the OnClick method of the button,I notify the external event.It works well! 

      The question is,when I click the button,it doest not make the change in view immediately.It changes the view until I click the model view window!I find there is a method called UIDocument.RequestViewChage in the API document,but I can't understand "Instead the request will be posted to occur when control returns to Revit from the API context".Another way of saying,how to return the control to revit in this case?

"

1 REPLY 1
Message 2 of 2
MarryTookMyCoffe
in reply to: Anonymous

I may miss the point of what you what, but you can get RibbonButton(or some other buttons) with: Autodesk.Windows.ComponentManager.PreviewExecute(you need to add to reference AdWindows)

        public Result OnStartup(UIControlledApplication application)
        {
            if(GetRibbonData())
            {
                SetRibonnAndButtons(application);
            }
            Autodesk.Windows.ComponentManager.PreviewExecute += ComponentManager_PreviewExecute;
            return Result.Succeeded;
        }

        private void ComponentManager_PreviewExecute(object sender, EventArgs e)
        {
          if(sender.GetType() == typeof(Autodesk.Windows.RibbonButton))
            {
                RibbonOption.AppAction.pushedButtonText = (sender as Autodesk.Windows.RibbonButton).Text;
            }

it give you control of pushed button before execute a ExternalCommand.

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report