In 3dsMax I can select a node,The result of selection is in this picture
3ds,But when I convert this model to svf format and select it in the forge viewer, it only selects part of it,like this forge
I don't know why this happens,Can someone tell me why this is? Thanks!
Forge Viewer has a default selection behavior where - when you click on something in the viewport - it will typically try to select the lower most node in the hierarchy. You should still be able to select an arbitrary node in the Model Browser window, or programmatically using viewer.select([nodeId1, nodeId2, ...]).
Related
We are using Autodesk Forge Viewer with DiffTool Extension to show the model differences between two versions of BIM360 models. Everything working fine except the count showing for the items that are Added/Removed/Modified. For the same model, the BIM360 compare tool shows different numbers compared to the DiffTool Extension. So, we are stuck with these mismatched numbers, any help on this issue is highly appreciated.
Thank you.
After investigating, this issue is addressed and resolved. The comments below for future reference:
ensure use the same model version urn
ensure load model with SVF2 data
const options = {
env: 'AutodeskProduction2',
api: 'streamingV2',
//getAccessToken: fetchForgeToken
accessToken: '<hard copy of token>'
};
ensure to specify the correct viewerable id (if not specified, viewer will load default 3D view, which might not be same to what are compared in BIM360).
I'm having some difficulties understanding how to update the AggregatedView instance and adding models.
I have checkboxes in my jstree that - when checked - updates an array with selected node id's. But in order to add or remove these models from the viewer I am reloading the viewer. This clears the cache and incurs a lot of waiting time (models that were selected but not removed needs to be reloaded). Anyone have any suggestions how I can update the viewer withouth completelty resetting everything?
The solution is to call a show/hide function of the aggregated viewer as I'm checking/unchecking models in the tree.
i'm new to the autodesk viewer and the others api and I could use some help figuring out what tools are the best to do what I want.
I'm using the autodesk viewer to let users generate 2d views of cut planes, in order to do this I simply use the getScreenshot function from the viewer and save it as a Blueprint in my app.
What I would like to do now is that when the user updates his 3d model, to automatically update my 2d views with the new 3d model.
Currently the only solution I came up with is to store the position of the camera when taking the screenshot and then when the 3d model is updated, have another computer in the background go in the viewer and take the screenshots again at the same location.
This does not seems to be a very elegant solution so I would like to know if there's an alternative, like a way to generate 2d views from an api call or maybe use the Design Automation API with the viewer to take the screenshots ?
Another thing i'm struggling with is getting precise measure of the 2ds views i'm generating, my current solution is to calculate the distance between the camera and the cut plane and then use the fov to get an approximate measure, the formula looks like this :
Math.tan((viewer.getCamera().fov / 2) * Math.PI / 180) * distanceBetweenCameraAndPlaneCut * 4;
but it is very dependent on the user facing the plane cut at a 90° angle and i'm thinking there should be something better to do with the measure tool.
Thanks a lot for your time!
You should be able to run the Viewer on a server using puppeteer (without client-side components) to generate screenshots: https://forge.autodesk.com/blog/running-forge-viewer-headless-chrome-puppeteer
Note: you could also use Design Automation API in order to do something similar, but then you are limited to the file formats the given product (e.g. AutoCAD) supports as input
You could also simply save the state of the Viewer and reset it next time you load the same model in order to take a screenshot of the exact same area using getState()/restoreState(): https://adndevblog.typepad.com/cloud_and_mobile/2015/02/managing-viewer-states-from-the-api.html
Why are you trying to measure the distance between cut plane and camera position? Is that in order to restore the Viewer state/camera? If so, then the solution mentioned in 2. should help
We are currently consuming utilizing the Forge Viewer in our product and also have an extension that allows us to interact with the Viewer. If we have already isolated some nodes on a loaded model, and then go to hide the entire model, the IsolateNodes property on the model's visibility manager is not updated. It continues to have the ids of the nodes that were previously isolated.
What can i do to have the IsolatedNodes property updated?
FYI....
The call we make to hide the entire model is as follows: "model.visbilityManager.hide(model.getRootId());"
The viewer3D.js version we are currently utilizing is v3.3.5
With the information from your question, I would say that you haven't fully unloaded the model or need to finish the viewer. One suggestion can be:
viewer.tearDown()
viewer.finish()
viewer = null
When I load two large models. The first one loads completely, but the second model does not show all objects. After I select "Show all objects" from context menu, the viewer refreshes and shows all objects.
Is there a way to trigger "Show all objects" with javascript? Or some other way to refresh the viewer?
I am not seeing this behavior on my side, maybe I am not testing with models large enough or the issue is specific to some of your models. If you have the models on A360, you can give it a try in my forge demo sample at https://forge.autodesk.io.
Simply authorize the app and should should see your models, double click an item to insert into the scene.
The first suggestion would be:
viewer.impl.sceneUpdated(true)
You can also try the command that is fired by the contextmenu:
viewer.showAll()