Skip to content

Instantly share code, notes, and snippets.

@salahelfarissi
Created February 17, 2023 15:35
Show Gist options
  • Save salahelfarissi/784796c339ea39ec917f919db6f203fc to your computer and use it in GitHub Desktop.
Save salahelfarissi/784796c339ea39ec917f919db6f203fc to your computer and use it in GitHub Desktop.
APS Environment Variables
export const APS_MODEL_URN = 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dHVubmVsLWJ1Y2tldC9yYWNiYXNpY3NhbXBsZXByb2plY3QucnZ0';
export const APS_MODEL_VIEW = '6bfb4886-f2ee-9ccb-8db0-c5c170220c40';
export const APS_MODEL_DEFAULT_FLOOR_INDEX = 2;
export const DEFAULT_TIMERANGE_START = new Date('2022-01-01');
export const DEFAULT_TIMERANGE_END = new Date('2022-01-30');
@yiskang
Copy link

yiskang commented Feb 20, 2023

Thanks, it looks fine. If so, let's do some experiments.

  1. Make APS_MODEL_VIEW to be an empty string in config.js:
export const APS_MODEL_URN = 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dHVubmVsLWJ1Y2tldC9yYWNiYXNpY3NhbXBsZXByb2plY3QucnZ0';
export const APS_MODEL_VIEW = '';
export const APS_MODEL_DEFAULT_FLOOR_INDEX = 2;
export const DEFAULT_TIMERANGE_START = new Date('2022-01-01');
export const DEFAULT_TIMERANGE_END = new Date('2022-01-30');
  1. And change the contents of the loadModel function in viewer.js like the following:
export function loadModel(viewer, urn, guid) {
    return new Promise(function (resolve, reject) {
        function onDocumentLoadSuccess(doc) {
            const viewable = guid ? doc.getRoot().findByGuid(guid) : doc.getRoot().getDefaultGeometry(true); //!<<< the `getDefaultGeometry(true)` will load first master view the viewer finds.
            resolve(viewer.loadDocumentNode(doc, viewable));
        }
        function onDocumentLoadFailure(code, message, errors) {
            reject({ code, message, errors });
        }
        Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure);
    });
}

@reachsak
Copy link

reachsak commented Jul 6, 2023

Thanks, It works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment