Copying a drafting view without changing the active view

Copying a drafting view without changing the active view

Anonymous
Not applicable
1,736 Views
6 Replies
Message 1 of 7

Copying a drafting view without changing the active view

Anonymous
Not applicable

I need to copy a drafting view from another project and read a few default parameter values.

 

However, the copied drafting view is set as the active view in the project browser and displayed on the screen.

 

How can i fix it so that my current active view is not changed and the copying and reading values is done in the background?

0 Likes
Accepted solutions (1)
1,737 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Accepted solution

One approach could be to "remember" the view your in, then do the copying of the drafting view, and after this is done, set the active view back to the "remembered view". 

0 Likes
Message 3 of 7

jeremytammik
Autodesk
Autodesk

Another suggestions beside Remy's very valid one:

 

Let's say your current project is A, and you wish to copy a drafting view from another project B into it without the view changing.

 

Apparently, as long as you are in project A, the view will change.

 

Suggestion: switch to some completely different project C first. Retain A as an open document, copy the view from B into A, and nothing visible will happen for the user, happily pondering some view in C.

 

Cheers,

 

Jeremy



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

0 Likes
Message 4 of 7

Anonymous
Not applicable

Thank you for the reply. How can i detect when the copying is done? Does Revit raise any event after the process is completed and before the copied view is activated?

 

 

0 Likes
Message 5 of 7

Anonymous
Not applicable

Thank you for the reply. The copying needs to be done in the background, without disturbing the current active view (switching to temp project, opens the project and sets its active view. This is not desired by the user). 

 

I tried intervening the UIDocument OnViewActivated() but even that is not giving the expected behavior.

 

 

0 Likes
Message 6 of 7

Anonymous
Not applicable

Thank you for the reply. How can i detect when the copying is done? Does Revit raise any event after the process is completed and before the copied view is activated?

 

0 Likes
Message 7 of 7

Anonymous
Not applicable

It worked thanks. Reverted the view in idling event. 

 

private void _uiApp_Idling(object sender, IdlingEventArgs e)
{
         // If internal copying is in progress and the active view is changed, revert the active view
         if (Settings.CopyViewInProgress && Settings.ActiveDoc.ActiveView != Settings.CopyViewData.ActiveView)
         { 
                 AppMain.Settings.UiDoc.RequestViewChange(Settings.CopyViewData.ActiveView);

         }

         Settings.CopyViewInProgress = false;

         Settings.CopyViewData = null;
}

0 Likes