8 Replies Latest reply on Sep 7, 2017 5:13 AM by drapo RSS
    vjain-2 Newbie

    Model pvz sequence binding at runtime

    I created mulitple sequences in a model. Now i have binded it with application parameter . i want to know how can i provide values to that parameter at runtime in Home.js or elsewhere.

    basically i want to change the sequence by calling different functions.

      • Re: Model pvz sequence binding at runtime
        dupatel Creator

        Vivek Jain: Yes, you can initialize and assign values to variables in Home.js and can also write JS functions which you would like to be called in case of some event or activity.

         

        -Durgesh

        • Re: Model pvz sequence binding at runtime
          Adam Macierzyński Explorer

          Hi,

           

          You need to go to the widget property through the $scope. You can find that your model widget has something called sequence property.

          3.PNG

          Sequences created in Creo software are saved in PVI format and it is a part of the PVZ model file. You can try to open PVZ file as an archive to see that it contains your sequences in separated PVI files.

           

          So now you can try with two things:

          1. Assign the sequence name directly to the property like this: $scope.view.wdg['model-1'].sequence = "mySecondSequence";

          2. Try to assign it by path like it is shown above. (it can be painful to figure out correct path).

           

          I didn't test it yet, so you can give me a feedback if it is working as you want.

           

          Regards,

          Adam

          • Re: Model pvz sequence binding at runtime
            drapo Newbie

            Hello

            I've tried to use .pvi file in hololens according to proposed solution above and are getting following error.

             

            Uncaught TypeError: Cannot read property 'stepVec' of undefined

                at vuforia-angular.js:1568

             

            And in debug mode I'm getting error on bold marked line:

             

            function loadSequence(url, speed, callback) {

                    // ignore speed, native sequencer doesn't have such concept

                    var pviParams = {

                        modelID: MODEL_ID,

                        url: url

                    };

                    renderer.loadPVI(pviParams, function (sequenceData) {

                        // load completed callback

                       STEPS = sequenceData.stepVec;

                        TOTALSTEPS = STEPS.length;

                        FIRST_STEP = 0;

             

             

                        // if step 0 has acknowledgment, start on step 0, otherwise start on step 1

                        if ((TOTALSTEPS > 0) && (STEPS[0].acknowledge === false) ) {

                            FIRST_STEP = 1;

                        }

                        // ThingView might still be on step 0, but the next step to be played is CURRENT_STEP

                        CURRENT_STEP = FIRST_STEP;

             

             

                        if ( callback !== undefined ) {

                            callback(undefined, undefined);

                        }

                    }, function () {

                        // load failed callback

                        console.log(MODEL_ID + " failed to load pvi " + url);

                    });

                }