Viewer model aggregation - coordinating problem

In the Viewer, I am dynamically aggregating models from multiple BIM files. The process involves initializing the viewer and then using LoadDocument and LoadModel for each model chosen by the user. These models are primarily NVC files (the ones I used for testing) that share a coordinate system. For the most part, the models load dynamically and stitch together correctly.

However, there seems to be an issue with the coordinate system when loading the second model - not always, but in some cases (specifically in v6.3 - I have not tested previous versions). When this problem occurs, I observe the following:

  1. Clicking the 'home' icon in the viewer only shows the first loaded model centered on the screen while the rest appear off-screen.
  2. Selecting an element results in selecting something else (with an offset), or in some cases, nothing at all (indicating the clicked coordinates were interpreted incorrectly).

After several attempts, it appears that this issue arises when the first loaded model does not occupy the full size of the aggregated model (such as one floor of a building).

I have found a workaround where, after loading the models, if I 'hide' and 'show' them again, it resolves the clicking and AGGREGATED_SELECTION event issues.

This solution is not ideal as I would prefer to load the models in the background while the user navigates around the existing aggregated model-set. Having to hide/show after loading a new model would disrupt the user experience.

Is there a way to 'reset' the viewer's coordinate system similar to what happens when hiding/showing the models?

Any assistance in resolving this issue would be greatly appreciated.

Thank you, Bandu

Answer №1

It appears that a significant offset is causing a precision problem, leading to the camera displaying excessive 'jittering'.

To resolve this issue, we must rectify the large offset by manually adjusting all geometry closer to the origin. Alternatively, correcting the original Navisworks file can also address the problem.

Firstly, let's approximate the offset value...

Hold down the ALT key and click on any object to set a green dot as the pivot point. Then utilize viewer.navigation.getPivotPoint() to retrieve the x, y, z value. (more details: https://github.com/wallabyway/markupExt/issues/2)

You will observe an xyz value similar to this... Z.Vector3 {x: 1296285.515098644, y: 14995636.431742325, z: 364.26238179027337}

Next, impose the global offset adjustment using this value to relocate all models precisely towards 0,0,0. like so...

line 70:

var modelOptions = {
    sharedPropertyDbPath: doc.getPropertyDbPath(),
    globalOffset: {x:1296285.515098644, y: 14995636.431742325, z:0}
};
viewer.loadModel(svfUrl, modelOptions, onLoadModelSuccess);

`

This action counteracts the impact of the substantial offset. As a result, the geometry no longer flickers, and the camera movement does not exhibit 'jittering' caused by precision concerns.

Please let me know if this solution proves effective for you. Michael

ps. You can extract the precise global-offset from the auxiliary AECModelData.json file, for more information refer to blog: forge.autodesk.com/blog/add-revit-levels-and-2d-minimap-your-3d

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

scope.$digest completes before triggering scope.$watch in Karma unit tests

I am interested in testing this specific directive: .directive('uniqueDirective', function () { return { restrict: 'A', scope: { uniqueDirective: '@', tooltip: '@', placement: '@&apo ...

What is the process of creating a new array by grouping data from an existing array based on their respective IDs?

Here is the initial array object that I have: const data = [ { "order_id":"ORDCUTHIUJ", "branch_code":"MVPA", "total_amt":199500, "product_details":[ { ...

Launching URLs from JSON data in the system browser - Apache Cordova

I am facing an issue with opening links from a JSON in the system browser on both Android and iOS devices. The link generated by the function appears as: {{item.addressLink}}, instead of bit.ly/xyzxyz Here is what I currently have: <a href="#" ng-cl ...

Disabling related videos in React Native: A guide to preventing suggested content from appearing at the end of YouTube videos

Is there a way to turn off the display of related videos after a YouTube video ends in react native? I've tried the following code, but it doesn't seem to be working: state = { isPlaying: true, related :false, }; <YouTube apiKe ...

AJAX requires manual updating by clicking on a button

I've created a chat system where two individuals can communicate with each other. An AJAX function has been implemented to update the message container every 2 seconds. However, I have noticed that the AJAX call doesn't run immediately after a u ...

Having trouble with submitting the code - need help resolving the issue

I'm facing an issue with my submit cancel code. The JavaScript code I implemented for preventing the submission function on my page isn't working as expected. While it does work to a certain extent, it's not fully functional. I am seeking a ...

Issues with React Material UI Dialog Displaying Incorrect Information

As I experiment with React Material UI dialog boxes, I've encountered an issue that has me puzzled. I have an object 'a', and when I click on a button in a list, it should display the respective ID number. However, instead of showing the cor ...

The framework for structuring web applications using Javascript programming

While I have extensive experience in PHP and C# programming, my knowledge of Javascript is limited. When it comes to server side programming, MVC is my preferred method as it allows me to keep my code well-organized. However, when it comes to writing Java ...

Encountered an error in Pytorch LSTM conversion to ONNX.js: "Uncaught (in promise) Error: LSTM_4 node does not recognize input ''

I am attempting to execute a Pytorch LSTM network in the browser, but I am encountering the following error: graph.ts:313 Uncaught (in promise) Error: unrecognized input '' for node: LSTM_4 at t.buildGraph (graph.ts:313) at new t (graph.t ...

Send JSON data using jQuery and process it in Node.js

Looking for guidance on how to send json form data from JavaScript by clicking the submit button and then receiving that json data on a Node.js server. My attempts so far have only resulted in printing '{} ' on the Node.js server terminal Below ...

Using PHP to convert JSON data into the Google Chart API

I am facing an issue with parsing my PHP generated JSON array into a Google chart. I have integrated JQuery, but for some reason, I am struggling to parse the JSON data. I execute a MySQL query to fetch data from the database. Then, I encode the query resu ...

Tips on working with an array received from a PHP script through AJAX

I've been stuck with this issue for the past few hours and I'm hoping to find a solution here. What I'm attempting to do is something like the following: PHP: $errorIds = array(); if(error happens){ array_push($errorIds, $user['user ...

Incorporate a new class for every date within the range of start and end

I have incorporated a JQuery event calendar plugin into my project, sourced from this specific website. Within my events, there are distinct start and end dates. Currently, I have managed to display green squares on the calendar for both the start and end ...

Creating a stylish navigation bar with custom components using Material UI and React

I've been experimenting with the BottomNavigation component from Material UI, but instead of using labels and text, I want to incorporate custom-made ImageButton components. Here's the code snippet from Material UI: import React from 'rea ...

Executing a function in AngularJS using PHP

My current project involves an Angular application that needs to load a PHP page within the view. The setup is functioning properly, but I now require an Angular function to run after the PHP code has loaded. I am wondering about the process of calling an ...

Tips for modifying a state array in Vuex

I have the ability to add and remove entries, but I'm struggling with editing. How can I achieve this using VUEJS, VUEX, and JavaScript? For adding entries, I know I should use PUSH, and for removing entries, SPLICE works fine. But what about editing ...

jquery global variable not working as expected

I'm having trouble making some variables global outside the jQuery function. I've tried using 'var' to declare them first and then assigning values, but when I try to log() them at the end, I get undefined. var lat, lon; $.get('ip ...

The issue where all buttons in a list are displaying the same ID

I am facing an issue with a row of buttons, all having the same class add-btn. Whenever I click on one button, I intend to log the id of its containing span. However, currently, all buttons are logging the span id of the first add-btn in the list. $(&apos ...

Adding an icon to the Autocomplete TextField in MUI v5 in Reactjs: A step-by-step guide

I created an autocomplete feature with the code below and attempted to display an icon after selecting each item, but unfortunately, it didn't work as expected! import { useState } from 'react' import { TextField,InputAdornment ,Autocomplete ...

Issues with the proper functionality of the .ajax() method in Django

I'm currently facing an issue with my Ajax code while trying to interact with the database in order to edit model instances. I noticed that the first alert statement is functioning correctly, however, the subsequent alert statements are not working as ...