"TypeError: container is undefined" when selecting element created with sceneBuilder using AggregatedView - autodesk-forge

I'm getting Uncaught TypeError: container is undefined thrown in a loop when I create a custom geometry.
Geometries are created using code from https://forge.autodesk.com/blog/custom-models-forge-viewer
I'm using the AggregatedView. The error does not occur when I instantiate a GuiViewer3D directly.
Uncaught TypeError: container is undefined
getFragmentConsolidationType ConsolidationIterator.js:398
updateRenderProxy ConsolidationIterator.js:416
updateRenderProxy RenderModel.js:973
updateSelectionProxies Viewer3DImpl.js:2145
renderOverlays Viewer3DImpl.js:2152
cmdRenderOverlays Viewer3DImpl.js:1330
executeCommandList Viewer3DImpl.js:913
tick Viewer3DImpl.js:1908
animloop Viewer3DImpl.js:1939
Is this a bug in Autodesk Forge? Using version 7.80
Selecting a custom geometry with the AggregatedView.
Expected the object to be selected.
Instead an error is thrown continuously.

The engineering team confirmed that this is a problem with the SceneBuilder extension not being compatible with "model consolidation" - a process where multiple meshes are merged into a single GPU buffer to improve rendering performance. The AggregatedView class consolidates models automatically, which is why you're running into this issue.
While we are not planning to add consolidation support to models generated by the SceneBuilder extension, we will update the extension and make sure that this combination is handled gracefully. In the meantime, if you need to use SceneBuilder models in an AggregatedView app, please unconsolidate your custom models using model.unconsolidate().

Related

Forge Viewer 7.71 throws errors when removing and recreating custom meshes in ModelViewer

I have an application that adds many custom meshes to the Forge Viewer using the ModelBuilder extension. This application has worked for quite a while but ran into issues with version 7.71 of the viewer.
When graphics are updated in my application, I remove all existing meshes and then recreate them based on new data. With version 7.71 of the viewer, when I recreate the meshes I get many instances the following error in the dev tools console:
Uncaught TypeError: Cannot read properties of undefined (reading 'material')
at FragmentList.getMaterial (FragmentList.js:760:1)
at FragmentList.getMaterialId (FragmentList.js:754:1)
at RenderBatch.js:222:1
at Int32Array.sort (<anonymous>)
at RenderBatch.sortByMaterial (RenderBatch.js:220:1)
at RenderModel.applyVisibility (RenderModel.js:388:1)
at RenderModel.nextBatch (RenderModel.js:360:1)
at RenderScene.reset (RenderScene.js:387:1)
at Array.cmdBeginPhase (Viewer3DImpl.js:1125:1)
at RenderCommandSystem.executeCommandList (Viewer3DImpl.js:847:1)
After these errors, the new meshes are not created.
The release notes don't mention anything about any expected changes here. Looking for guidance from the Autodesk team.
Here is a repo that reproduces the issue:
https://github.com/bencameron/custom-mesh-refresh
I'm told it will take some time to implement the fix (ticket id LMV-6757). In the meantime you could stick with v7.70 or try these workarounds a colleague suggested:
1.) If all of the custom geometry is removed, like it is in the example app, it's probably simpler to remove the model entirely and start with a new one. Here is an (untested) snippet to do that:
// Instead of deleting all geometries individually, simply delete the model and create a new one
viewer.unloadModel(modelBuilder.model);
// drop the reference to the model builder instance, i.e. assign a new instance
modelBuilder = await sceneBuilder.addNewModel({});
// start adding the geometry again...
...
2.) If option #1 doesn't work, or if the user doesn't want to delete all geometries, they could also avoid the crash by running this snippet right after adding new geometries (i.e. every time they add a batch of geometries):
const scenes = modelBuilder.model.getIterator().getGeomScenes();
for (let i = 0; i < scenes.length; ++i) {
scenes[i].numAdded = 0;
}
I would recommend the first option over the second one if applicable.

A-Frame: Error when using tracked-controls-webxr

I am using the A-Frame watcher plugin to create the scene, I was creating two entities for left and right tracked-controls-webxr. When I start my dev server from webpack I get this error:
core:a-node:error Failure loading node: TypeError: Cannot set properties of undefined (setting 'buttonStates')
at init (tracked-controls-webxr.js:25:64)
at initComponent (component.js:320:10)
at i.updateProperties (component.js:302:12)
at i.module.exports.Component (component.js:78:8)
at new i (component.js:662:15)
at HTMLElement.value (a-entity.js:332:19)
at HTMLElement.value (a-entity.js:495:12)
at HTMLElement.value (a-entity.js:463:14)
at a-entity.js:249:14
at a-node.js:127:21
Originally I had the two entities as childs to the camera cause that makes sense to me, but the page wouldn't load, I moved them out the page loads but I still get the errors.
afaik the tracked-controls are supposed to set up thetracked-controls-webxr:
tracked-controls sets two components that handles different Web API versions for VR:
tracked-controls-webvr
tracked-controls-webxr
You're getting an error, because tracked-controls-webxr are trying to access tracked-controls and fail - hence Cannot set properties of undefined (setting 'buttonStates').
Try using tracked-controls, or mimic their setup

#grapecity/wijmo throwing run time error after upgrading my Angular project from 8 to 9

Recently iam trying to update my angular project from 8 to 9. While updating i also updated wijmo from wijmo/wijmo to #grapecity/wijmo package as it supports IVY.
But after the completing the upgradation, i can able to compile the application but i am getting the following error at run time
global-error-handler.service.ts:43 Error: Uncaught (in promise): TypeError: (0 , t[n]) is not a function
TypeError: (0 , t[n]) is not a function
at backend.js:61
at Reflect.<anonymous> (backend.js:61)
at push../node_modules/#grapecity/wijmo.angular2.grid.detail/__ivy_ngcc__/index.js.__decorate (index.js:28)
at index.js:53
at Object../node_modules/#grapecity/wijmo.angular2.grid.detail/__ivy_ngcc__/index.js (index.js:53)
at __webpack_require__ (bootstrap:84)
I'd like to get some more info about this error. The quick thing to check is property initialization order. In Ivy, the properties are interpreted as they are specified in markup (previously wijmo controlled how they were interpreted). So you can break components by setting certain properties before others.
For example, if I tried to set the selectedIndex on a combobox BEFORE I set the data source, then the app would break at runtime because there are no items in the list to select yet.
More info here: https://www.grapecity.com/wijmo/docs/GettingStarted/Angular-Components#property-initialization-order-in-angular-9-ivy-and-higher
The next thing to check is component decorators (if you are inheriting our components). There are some breaking changes in decorators in Ivy.
For example, you might need to add {descendants: true} to ContentChildren queries.
Or you might need to add an #Injectable decorator to your class.
You can read more about breaking changes in Ivy and how to fix them here: https://angular.io/guide/ivy-compatibility-examples
But please feel free to contact us to work directly: wijmoexperts#grapecity.com

Forge viewer Document.load throws exception on mobile devices

We are using Forge viewer version 3.2.x.
For Autodesk.Viewing.Document the function load(documentId,onSuccessCallback,onErrorCallback,accessControlProperties) the parameter accessControlProperties is listed as required (see Autodesk Forge Documentation). Not providing this parameter still works on Chrome / Firefox, but I discovered that missing the parameter causes problems on mobile devices. However, for this parameter there seems to be no example or specification available.
Maybe the problem is not the missing parameter itself but something else...? Getting the following exception in browser console:
Uncaught TypeError: Cannot read property 'id' of null
at PinchRecognizer.recognizeWith (viewer3D.js?v=3.2.*:2300)
at Array.forEach (<anonymous>)
at each (viewer3D.js?v=3.2.*:923)
at invokeArrayArg (viewer3D.js?v=3.2.*:903)
at PinchRecognizer.recognizeWith (viewer3D.js?v=3.2.*:2294)
at new Autodesk.Viewing.GestureHandler (viewer3D.js?v=3.2.*:16042)
at GuiViewer3D.Viewer3D.createControls (viewer3D.js?v=3.2.*:44685)
at GuiViewer3D.Viewer3D.initialize (viewer3D.js?v=3.2.*:44758)
at GuiViewer3D.initialize (viewer3D.js?v=3.2.*:50852)
at GuiViewer3D.Viewer3D.start (viewer3D.js?v=3.2.*:44555)
Using Viewer.loadDocument(documentId,onDocumentLoad,onLoadFailed,accessControlProperties) is not an option, because we must load multiple models into the viewer.
Apologies for the late response, we have a backlog in the queue due to the IFC issue this week.
According to my experience, the accessControlProperties is not a required parameter for using ViewingApplication.loadDocument(). Could you consider providing a reproducible case demonstrating this issue to forge.help#autodesk.com? I'm glad to help you check what happened.
A non-confidential reproducible case contains following items:
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.
Some complete yet minimal sample models to run a test in. For example, Revit sample models here: https://knowledge.autodesk.com/support/revit-products/getting-started/caas/CloudHelp/cloudhelp/2016/ENU/Revit-GetStarted/files/GUID-61EF2F22-3A1F-4317-B925-1E85F138BE88-htm.html.
A complete yet minimal Forge viewer app that can run and debugged.
Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
Thanks for your reply, Eason - isolating the issue from our whole application was quite difficult, but made me finally find the problem myself:
We had a conflict with another JavaScript library that is included in our minified js file. The GestureRecognizer classes are named similar as in the camunda library which we are using for modelling bpmn processes. Solved it by excluding that library from the global js and include it only where it is needed, same as how we are dealing with forge library.

Unknown warning: "Member from unopened namespace"

Within my Pure AS3 app (using IntelliJ) I'm getting the following warning:
"Member from unopened namespace" associated with the instance of the model.
The initial instantiation of the Model is fine (singleton) but each reference to it within the class that it's instantiated after the constructor are throwing the above warning.
The model it's self appear fine as is instantiated without issue from multiple other view classes.
Has anyone come across this before? Interesting that neither SO or Google verbatim throws up any results.
as ever, all suggestions and help appreciated!