0

I'm using Autodesk Viewer 7.x and trying to load multiple models using the MultipleModelUtil.js utility from this GitHub repo: đź”— https://github.com/yiskang/MultipleModelUtil

However, I'm encountering the following error:

javascript

NodeConsolidation.js:362 
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'transparent') 

First, I confirmed that it is not a MultipleModelUtil.js issue. (Reference: https://github.com/yiskang/MultipleModelUtil/issues/2)

This happens when I try to load multiple IFC models. I suspect this might be due to one of the following:

  • A conflict in viewer settings
  • Running on HTTP (not HTTPS), possibly preventing OPFS caching from working correctly?

Below is a screenshot of the error (loading two IFC files):

Here is a simplified version of my code:

javascript

const MODEL_LIST = [
  { name: "filename1.ifc", urn: "urn:..." },
  { name: "filename2.ifc", urn: "urn:..." }
];

Autodesk.Viewing.Initializer(options, function () {
    viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('viewer'));
    const startedCode = viewer.start();
    settingProfile();

    if (startedCode > 0) {
        console.error('Failed to create a Viewer: WebGL not supported.');
        return;
    } else {
        const multiModelUtil = new MultipleModelUtil(viewer);
        multiModelUtil.options = {
            alignment: MultipleModelAlignmentType.ShareCoordinates,
        };
        multiModelUtil.processModels(MODEL_LIST);
    }
});

function settingProfile() {
    try {
        const viewerProfileSettings = {
            settings: {
                optimizeNavigation: false,
                ghosting: true,
                antialiasing: true,
                lineRendering: false,
                edgeRendering: true,
                reverseMouseZoomDir: true,
            },
        };
        const viewerProfile = new Autodesk.Viewing.Profile(viewerProfileSettings);
        viewer.setProfile(viewerProfile);
    } catch (error) {
        console.error('Error applying profile settings:', error);
    }
}

My questions:

  1. What could be causing the reading 'transparent' error?
  2. Is it related to model alignment, profile settings, or problems using OPFS in HTTP operating environment?
  3. Has anyone else successfully used MultipleModelUtil to load multiple IFC models with shared coordinates?

Environment:

Viewer version: 7.x

  • Browser: Chrome (latest)
  • Hosting: Local server via HTTP (not HTTPS)
  • Models: Revit-exported IFC files

Any help would be appreciated!

Cannot read properties of undefined (reading 'transparent') error message capture image1

Cannot read properties of undefined (reading 'transparent') error message capture image2

8
  • It says here that OPFS does not work with HTTP: stackoverflow.com/questions/79148557/… You could try to disable it if HTTP is important: aps.autodesk.com/blog/… Commented Jul 22 at 14:47
  • @AdamNagy Thank you for the response. Disabling OPFS removed the OPFS warning, but the "Cannot read properties of undefined (reading 'transparent')" error message still occurs. It seems to only happen when loading more than one model in an http environment. Commented Jul 24 at 0:31
  • After rereading the stackoverflow reply it seems the issue was with the certificate. Could you try using HTTPS for local tests as well? Commented Jul 28 at 12:02
  • @AdamNagy Thank you for your reply. I've tested locally over HTTPS using ngrok, but the Cannot read properties of undefined (reading 'transparent') error still occurs intermittently when loading multiple models. It seems to happen randomly during the multi-model loading process. I'm worried that this error might cause an error in the service that I'm not aware of. Commented Jul 29 at 4:46
  • Can you reproduce it with the sample code my colleague provided? github.com/yiskang/MultipleModelUtil/issues/… Does it only happen with IFC models, only with specific IFC models? Can you check put a breakpoint in the code that is throwing the error and check if you can figure out anything there? Commented Jul 30 at 8:49

1 Answer 1

0
  1. It's still not clear to me why you are even testing with HTTP? HTTPS is the standard nowadays

  2. I reloaded 115.178.65.25:60025/smesweb/viewer?cdC=9100&cdP=9992 multiple times and the only issue I saw, apart from the OPFS issue, is this:
    TypeError: event.model.getData is not a function
    TypeError: event.model.getData is not a function
    And you can solve it by adding a check at the beginning of progressUpdated

    const progressUpdated = (event) => {
      // check if the data is available
      if (!event.model.loader)
        return;
    
      let modelDataIndex = data.findIndex(d => d.urn.includes(event.model.getData().urn));   
    
      // etc.
    
Sign up to request clarification or add additional context in comments.

3 Comments

The TypeError: event.model.getData is not a function error can be resolved by enabling "Settings > Large model experience". After that, even after adding the code you suggested to MultipleModelUtil.js, I still get the TypeError: Cannot read properties of undefined (reading 'transparent') error.
Switched on "Large model experience" and still only seeing the OFPS errors
@astromelon It appears your web browser cached the old version of your code. Please try to clear the cache and retry. I'm seeing the same as Adam did. We don't see the transparent error message even when testing with your test app. i.sstatic.net/7W1UdYeK.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.