Change view to 3D

Change view to 3D

ywkimPXXW3
Participant Participant
215 Views
1 Reply
Message 1 of 2

Change view to 3D

ywkimPXXW3
Participant
Participant

I try to change view to 3D.

 

RevitDB.View3D view3D = new RevitDB.FilteredElementCollector(m_uiApp.ActiveUIDocument.Document).OfClass(typeof(RevitDB.View3D)).Cast<RevitDB.View3D>()
                .Where(x => !x.IsTemplate).FirstOrDefault();
m_uiApp.ActiveUIDocument.ActiveView = view3D;
//m_uiApp.ActiveUIDocument.RequestViewChange(view3D);
m_uiApp.ActiveUIDocument.RefreshActiveView();

 

View is changed after ExternalEvent is end.

 

I want to show progress using RefreshActiveView in 3D.

(Change view to 3D -> Do something(Transaction))

 

But, the code change view after all code is end.

(Run change view code -> Do something(Transaction) -> Change view to 3D)

 

How can I change the view directly?

0 Likes
Accepted solutions (1)
216 Views
1 Reply
Reply (1)
Message 2 of 2

ywkimPXXW3
Participant
Participant
Accepted solution

Sloved!

 

When I change view before ExternalEvent.Raise().

 

RevitDB.View3D view3D = new RevitDB.FilteredElementCollector(m_uiApp.ActiveUIDocument.Document).OfClass(typeof(RevitDB.View3D)).Cast<RevitDB.View3D>()
    .Where(x => !x.IsTemplate).FirstOrDefault();
m_uiApp.ActiveUIDocument.ActiveView = view3D;
m_uiApp.ActiveUIDocument.RefreshActiveView();

if (ExEvent != null)
    ExEvent.Raise();
0 Likes