get 3d view with thelp of coding revit api

get 3d view with thelp of coding revit api

Anonymous
Not applicable
4,147 Views
2 Replies
Message 1 of 3

get 3d view with thelp of coding revit api

Anonymous
Not applicable

i had imported an adsk model with the help of revit api but when the model is imported, its view is in 2dimensional view level1, i want that my code also set the view to 3d of the opened model, can someone please help? i had tried googling but the every next code i had tried produced some sorts of errors.

0 Likes
4,148 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

even in the view section,i m having only floor ceiling and elevation view...to view it as 3d box, i manually have to go to view tab and then click on default on 3d but i want to do it through my code so please if someone can help.

0 Likes
Message 3 of 3

Anonymous
Not applicable

You can enumerate all views, if you find a 3D View you can just select it into ActiveView. If you don't find one, you may have to create a new 3D View.

 

E.g. something like:

 

View3D view3d;

using (var collector = FilteredElementCollector(document))
{
    view3d = collector
                    .OfClass(typeof(View3D))
                    .Cast<View3D>()
                    .FirstOrDefault();
// Note: may want an intelligent predicate in the call to FirstOrDefault() depending on your needs } if (view3d == null) { // Need to create the view // I don't think you will need this, since there is almost always a default 3d view, but if you do look for View3D.CreateIsometric API call } // Activate the 3d view uiDocument.ActiveView = view3d;

Mark - Engineering at UpCodes

p.s. we are hiring - if you love building Revit addins please reach out!

0 Likes