3D View Manipulation

3D View Manipulation

jshial
Advocate Advocate
375 Views
4 Replies
Message 1 of 5

3D View Manipulation

jshial
Advocate
Advocate

Hi community,

 

I am trying to simulate View Cube by assigning a transformed BoundingBoxXYZ to View3D.CropBox property. As far as I have observed, changes happen to CropBox property when I use View Cube to manipulate 3D view.

 

Seemingly, it does not work.

 

Assume I have already oriented the 3d view to look downward, now I want to rotate the view itself for 90 degree. The process I have in mind is:

 

jshial_0-1641287013035.png

 

Yet, nothing happens. 

 

Any help will be appreciated. Happy Little-Bit-Late New Year!

 

0 Likes
Accepted solutions (1)
376 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni
Accepted solution

In your code, you are setting the crop box. 

 

I do not believe that that affects the view.

 

I think you need to set up the camera, view direction, etc.

 

This example ought to show you how this can be achieved:

 

https://thebuildingcoder.typepad.com/blog/2019/06/revit-camera-settings-project-plasma-da4r-and-ai.h...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

jshial
Advocate
Advocate

Hi Jeremy,

 

I made it thanks for your help. But still have some confusion.

 

At very beginning, I had the same idea of setting the camera orientation. So I had set the camera to look downward. The reason I did not keep explore camera settings and went for CropBox (except for the change on CropBox's transform), was a little test I made:

 

I took out my phone,  aim at my screen. Gradually, tilt my phone camera from 0 ~ 90 degree. So location and gaze direction remains the same, only up direction changes. I realize the image/scene changes from Portrait to Landscape, yet the image/scene itself is static.

 

But same process for virtual camera in a View3D instance indeed "rotate" the scene. I am still a bit confused over the difference here. Could you elaborate more on this?

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

Glad to hear you made it! Thank you for your appreciation.

  

I think the rotation that you mean is defined by the ViewOrientation3D UpDirection property:

 

https://www.revitapidocs.com/2022/1353f55a-719d-75d2-a095-a70fbde71a4c.htm

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 5

jshial
Advocate
Advocate

indeed. I had never taken Up Direction seriously. Thx Jeremy!

0 Likes