How to create selection box to get new Defoult 3D view

Or.levi
Contributor
Contributor

How to create selection box to get new Defoult 3D view

Or.levi
Contributor
Contributor

Hey,

in order to get a RefrenceIntersector, i need to pass 3dview of the elements that i would like to project rays upon.

 

is there a way to make the Defoult 3D view to be the current view? ( just like pressing on the Selection box button in 

revit to isolate elements in 3d view-->but programmatically) 

i tried to use: 

View3D view3d = doc.ActiveView as View3D;

but it seems that it's not working well. 

 

thanks,

 

 

Reply
309 Views
2 Replies
Replies (2)

jeremy_tammik
Autodesk
Autodesk

You can access the default 3D using the line of code you list if it already is the current view.

 

If it is not, then you can programmatically make it so by setting the UiDocument ActiveView property:

 

https://www.revitapidocs.com/2022/b6adb74b-39af-9213-c37b-f54db76b75a3.htm

 

If you need a view with only specific elements for a reference intersector, you can easily  create a new one for it on the fly.

 

Look at the samples creating and setting up a 3D view:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.37

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

Or.levi
Contributor
Contributor

Hey jeremy, 

Thanks for your response! 

1. If i choose to use the ActiveView property on the default 3D view , it might be set to some randome element that has been isolated by the user before.. 

2.  i went over all the related links in the "Creating and setting 3D views" and couldn't find refrences for how to actually make a 3D view out of a plan view. 

 

i  am trying to programatticaly imitate the function of selecting a plan view, and than pressing on the "section box" button to create 3D isolated view of the selected elements. 

Orlevi_1-1655455675696.png

thank you !

 

 

 

 

0 Likes