Skip to main content
21-Topaz I
May 3, 2018
Solved

Re: Model pvz sequence binding at runtime

  • May 3, 2018
  • 3 replies
  • 6604 views

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.

    Best answer by A_Macierzynski

    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

    3 replies

    5-Regular Member
    August 31, 2017

    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

    August 31, 2017

    I am aware of initializing the variables in Home.js.

    I want to know in particular about the sequence property of model and how to set it for multiple sequences.?

    15-Moonstone
    August 31, 2017

    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

    5-Regular Member
    August 31, 2017

    Also, can check and try

    $scope.view.wdg['model-1']['sequence'] = seqname;

    1-Visitor
    September 7, 2017

    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);

            });

        }

    16-Pearl
    April 5, 2018

    same issue here, any solutions?!