Mykita
Mykita

Reputation: 467

Position/orientation of model in Forge Viewer

I have set a specific orientation for my model in Revit, but as it gets loaded in the Forge Viewer is appears that the viewer overrides the coordinates of what I've set in Revit.

Where/how can I edit the "home-screen" for my model in the viewer?

Upvotes: 2

Views: 2051

Answers (1)

Eason Kang
Eason Kang

Reputation: 7080

There are two ways to do this in my experience, one is using Set current view as Home in the Revit ViewCube, another is using Viewer3D state API in the Forge Viewer.

In the Revit part, you can do this in this ways:

  1. Open a 3D view, then duplicate it with an new name. Don't use the default name {3D}.
  2. Set a specific camera orientation in this 3D view, then click the Set current view as Home in the Revit ViewCube to save current view as the default view.
  3. Pick this 3D view in the Publish Settings to tell the Forge Model Derivative service to translate this for viewing in the Forge Viewer, then click save button to assign this 3D view as the Web view for the Forge.
  4. Save this Revit project and upload it to the Forge for model translation. Forge Model Derivative service will use the camera position in the Home view you set in the above steps as the default camera position of the Forge Viewer.

In Forge Viewer side, you can do this:

  1. Set a specific camera orientation in your viewer app, then call viewer.getStatus( { viewport: true } ) to get current camera state (One time only).
  2. Remember this camera state somewhere.
  3. Restore this camera state after all geometry is loaded via the viewer.restoreState( thisCameraState ) every time.
  4. If you want to override the default Home view of the Forge Viewer, you can simply call viewer.utilities.autocam.setCurrentViewAsHome() after the step 3.

==== Update ====

If you still have some problem related to this issue, you can consider providing a reproducible case demonstrating that, I will gladly analysis for you. Those following items should be in the reproducible case:

  1. A short exact description of what you are trying to achieve. The behavior you observe versus what you expect, and why this is a problem.
  2. A complete yet minimal sample source model to run a test in.
  3. A complete yet minimal Forge app that can be run and debugged with a simple procedure to analyze its behavior lives in the sample model.
  4. Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.

If your reproducible case could not be posted here publicly, please send it to the [email protected] and remove sensitive data or information before you send.

Hope this help.

Upvotes: 2

Related Questions