Position/orientation of model in Forge Viewer - autodesk-forge

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?

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:
Open a 3D view, then duplicate it with an new name. Don't use the default name {3D}.
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.
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.
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:
Set a specific camera orientation in your viewer app, then call viewer.getStatus( { viewport: true } ) to get current camera state (One time only).
Remember this camera state somewhere.
Restore this camera state after all geometry is loaded via the viewer.restoreState( thisCameraState ) every time.
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:
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.
A complete yet minimal sample source model to run a test in.
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.
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 forge.help#autodesk.com and remove sensitive data or information before you send.
Hope this help.

Related

Is it possible to pre-select level before loading Forge3D viewer?

In the attached image, the minimap circled in red can be selected as floor(level).
Is it possible to pre-select it before loading Forge3D viewer?
minimap
There are several ways in which you can control what exactly gets loaded into the viewer:
The Forge Model Derivative service can generate multiple outputs (also called "viewables" or "derivatives") for a single design file. For example, in case of Revit designs, the service generates separate viewables for each 3D view and each 2D sheet. So if you have control over the input design files, you could perhaps create a custom 3D view for each floor in the original design, and then instruct the viewer to load the specific viewable with your floor.
Forge Viewer loads an entire viewable by default but you can also configure it to only load a subset of geometries from a viewable. This is done by passing a list of object IDs to the loader as explained in this blog post: https://forge.autodesk.com/blog/minimizing-viewer-workloads-loading-models-partially-selected-components-and-features-only. Of course, this means that you would have to be able to identify objects belonging to a specific floor. That is a topic for another question, though.

Questions about Autodesk Forge Viewer API

I couldn't find Forge Viewer API demo site and don't know what it looks like. I appreciate it if you have some experience using it and answer questions below.
Can you put markup comments on 3D models easily?
When you update comments, are they automatically saved right after you click some update button?
Can you delete 3D model data easily?
Is it mandatory to upload 3D model data to the Autodesk cloud server when you use the Forge Viewer? I don't want to put design data outside of my service but want to see 3D model on a browser.
You can upload any model and check with Viewer through viewer.autodesk.com
We have a few options for markups on documents. this blog might be helpful. You can also take advantage of sprites and textgeometry for labeling your models
Depending on the method you'll need to implement an algorithm to save, store and load your markups.
The data you see with Viewer is the SVF(2) generated by a translation from a source file. To modify the source file, you'll need to run a Design Automation job.
You need to upload your models to a bucket in order to trigger a translation, generating an SVF(2) that can be rendered with Viewer (refer here).
Formats like gltf, pdf, and dwf can be loaded without the need for translations.

How to Export Multiple 3D Views

My Revit project contains multiple 3D views.
By default only the {3D} View will be translated. I would like to know how to choose which 3d view to upload.
I found this post where a solution to the problem is described. Export Multiple 3D Views
The plugin is no longer available, but this function will surely still exist.
When I upload the Revit project to BIM 360, I only get a small part of the created 3D views displayed.
I only want to visualize a small part of the project in AR.
My current solution is to display the part in the {3D} view via section box, save the project, upload it and then prepare it for Unity with the AR/VR toolkit.
Started Revit 2017, it got renamed as Publish Settings, please check this page: https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/Revit-CAR/files/GUID-09FBF9E2-6ECF-447D-8FA8-12AB16495BC3-htm.html
Please select views you want to see in Forge Viewer in view sets of the Publish Settings before uploading to Forge for translation. Afterward, save the modified RVT to your hard disk, then upload it to Forge OSS.

Mass models from FormIt do not render in Autodesk Viewer

Autodesk Viewer doesn't seem to render Mass models that were created in FormIt and converted to RVT. I can only see the level delimiters.
I've tried both https://viewer.autodesk.com/ as well as a basic viewer app I built using the Forge tutorials. This is an important part of a system that I'm trying to put together using a few of the Forge APIs.
If Mass type elements cannot be seen in the Viewer, is there a modification I could do using Design Automation v3 that would make the models visible?
Per Eason's advice I added the 3D view to the view set and that enabled the model to fully render in the Autodesk Viewer. This config option can be found under Collaborate->Publish Settings. All models that I imported from FormIt started off with all their views deselected in the view set.

Detail in forge viewer vs A360

I made a query about this previously but with further investigation I still have a problem. The two screenshots show the same component in A360 and in our Forge viewer. The behaviour in A360 is what we want with only the external geometry of the component visible. This used to be the case in our webapp but a change made to the Forge viewer at some point means all the detail in the component is now visible, including internal details. How can we replicate the behaviour we see in A360 in our forge viewer?A360
What you need to do is to force The viewer at startup using
options.isAEC = false
This will make the Viewer go back to the Highlight view that A360 is using at the moment.