Announcements
Notice: Upload of PDF documents is currently unavailable across the Community due to an ongoing issue.

Item.Id "Synchronize and modify settings"

Item.Id "Synchronize and modify settings"

Anonymous
Not applicable
514 Views
1 Reply
Message 1 of 2

Item.Id "Synchronize and modify settings"

Anonymous
Not applicable

Hello everyone !!

I have a little problem.
Y want to add an event listener witch will react when you click on "Synchronize and modify settings". But I don't know how to do it. I have tried to add it to an existing ComponentManager_UIElementActivated(), but the second part is not working !
Don't know if it's not the right item.id or if it's the all thing witch is not possible.
Here is my code :

 void ComponentManager_UIElementActivated(
          object sender,
          adWin.UIElementActivatedEventArgs e)
        {
            if (e != null
              && e.Item != null
              && e.Item.Id != null
              && e.Item.Id == "ID_TBC_BUTTON")
            {
                // Perform the button action
                ClassLibrary3.Form2 form = new ClassLibrary3.Form2();



                if (form.ShowDialog() == DialogResult.OK)
                {

                    resultat = form.resultat;
                    workerObject.Str(resultat);
                    System.Windows.Forms.MessageBox.Show(resultat);
                }
            }
            else if (e != null
              && e.Item != null
              && e.Item.Id != null
              && e.Item.Id == "HID_FILE_SAVE_TO_MASTER")
                {
                // Perform the button action
                ClassLibrary3.Form2 form = new ClassLibrary3.Form2();



                if (form.ShowDialog() == DialogResult.OK)
                {
                    resultat = form.resultat;
                    workerObject.Str(resultat);
                    System.Windows.Forms.MessageBox.Show(resultat);
                }
            }
            }
0 Likes
515 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

You are using the .NET Automation library, which is not officially supported by the Revit API.

 

I do not think this will help you achieve what you want.

 

It does not give you a valid Revit API context.

 

The Revit API can only be used within official Revit API callback methods, event handlers subscribed to official Revit API entry points.

 

Will the the Application.DocumentSynchronizingWithCentral event possibly be of use to you?

 

At least that is an official Revit API entry point that will provide you with a valid Revit API context.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes