cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Can't use more than one sequence animation in a single experience in ThingWorx studio.

dsengupta
1-Newbie

Can't use more than one sequence animation in a single experience in ThingWorx studio.

I am trying to develop an experience in ThingWorx Studio where in each view different sequence will be shown. But after adding one pvz+pvi, when I am trying to go to the next view and another pvz+pvi, the pvi file is not getting uploaded. Please help me with the problem...

Thank you...

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Dipika, Parnaz,

sorry for the late reply - was stuck in project work the last two weeks.

Checking and testing the functionality today I found that there is a slight change based on the new renderers. Before 1.10 you had to extract the *.pvi files from the *.pvz file - now this is not required anymore. Before you had to set the complete relative path as value in the binding to the sequence property of the model widget, now you only need the base filename (the complete path works as well - it truncates it to the base name).

Based on this info you can assign the Figure in two ways:

  1. Via Javascript: e.g. use a Button widget and add the following line to the Click Event handler:

setWidgetProp( 'model-1', 'sequence', 'Figure 1.pvi');

     where:

    • model-1 is the ID of the model widget. You have to adjust it to your experience design.
    • sequence is the property name. This is always the same in this case.
    • Figure 1.pvi is the value of the property. You should use one of the values that you see in the dropdown for Sequence URL

     Here is a screenshot of this event handler:

    

     2. Alternatively you can use connection bindings (with or without filters). Here is a slick example of a dropdown with a hardcoded value set, that it gets from a application parameter.

The app param value is a JSON formatted array. You have to use double-dashes (" not ' !) in it. In this example it is:

[{"val":"Figure 1.pvi"},{"val":"Figure 2.pvi"}]

The object attribute name val must be specified in the Value Field and Display Field properties of the Select widget.

The app param is then bound to the List property of the Select widget. This binding has a filter on it with the following expression:

return angular.fromJson(value);

Finally you bind the Value property of the Select widget to the Sequence URL property of the Model widget and that's it.

Have fun!

View solution in original post

24 REPLIES 24

Hi Dipika,

do you use multiple pvz files and multiple model widgets?

Or do you have one pvz with multiple animations? You can get multiple animations in one pvz file by creating multiple Figures. This will result in multiple pvi files inside the pvz. If you want to use them and switch them e.g. by javascript code, you have to extract the pvi files from the pvz (rename the pvz to *.zip and extract it) and add these pvi files to the Resources. You can then select and also switch the sequences by javascript code or by connections with filters (see Using Connection Filters for state-based rendering and value formatting). You may want to rename the pvi files so that you can better identify them.

I used this approach and it worked fine. I haven't tested it with 1.10 yet though.

Cheers, moritz

Hi Moritz,

Thanks for your reply. Can you give me any reference material for switching the sequences by javascript code?

Thanks,

Dipika

Did you find a solution or JS code for switching? If so pls share it. I need that too.

Thanks

Hi Dipika, Parnaz,

sorry for the late reply - was stuck in project work the last two weeks.

Checking and testing the functionality today I found that there is a slight change based on the new renderers. Before 1.10 you had to extract the *.pvi files from the *.pvz file - now this is not required anymore. Before you had to set the complete relative path as value in the binding to the sequence property of the model widget, now you only need the base filename (the complete path works as well - it truncates it to the base name).

Based on this info you can assign the Figure in two ways:

  1. Via Javascript: e.g. use a Button widget and add the following line to the Click Event handler:

setWidgetProp( 'model-1', 'sequence', 'Figure 1.pvi');

     where:

    • model-1 is the ID of the model widget. You have to adjust it to your experience design.
    • sequence is the property name. This is always the same in this case.
    • Figure 1.pvi is the value of the property. You should use one of the values that you see in the dropdown for Sequence URL

     Here is a screenshot of this event handler:

    

     2. Alternatively you can use connection bindings (with or without filters). Here is a slick example of a dropdown with a hardcoded value set, that it gets from a application parameter.

The app param value is a JSON formatted array. You have to use double-dashes (" not ' !) in it. In this example it is:

[{"val":"Figure 1.pvi"},{"val":"Figure 2.pvi"}]

The object attribute name val must be specified in the Value Field and Display Field properties of the Select widget.

The app param is then bound to the List property of the Select widget. This binding has a filter on it with the following expression:

return angular.fromJson(value);

Finally you bind the Value property of the Select widget to the Sequence URL property of the Model widget and that's it.

Have fun!

Thank you so much Moritz. It was a great help.

Hi Parnaz Samie Adel,

which solution did you implement? If you did the second one, was it possible to you to set a default value? How did you do that? Maybe you could also have a look at this:

Is it possible to set a default value for choosing a sequence animation during runtime?


I would be very happy if you or Moritz von Hasselbach could help me!

Thank you moritz for your help!! I am really sorry for the late reply as I was busy in some other work...

Thanks!!!!

DFFHTW
6-Contributor
(To:mvonhasselbach)

Hi,

I did everything as shown in the Alternative 2.

I also bound the click event of a button to 'play' of the model.

I can see the two .pvi files in the dropdown menu, but it doesn't play the sequence after clicking the button.

Do you know how to solve this?

Regards,

DF

mwassmann
5-Regular Member
(To:DFFHTW)

Correct naming of the pvi files?

Have you tried the first version? that is definitely working as of today - the post is over 1 yr old.

DFFHTW
6-Contributor
(To:mwassmann)

Alternative 1 doesn't work for me either.

And yes, I did use the right file names.

I inserted three buttons, one for setting the widget prop to figure 1 and one for figure 2.

The third button is just to call the play event on the model.

I tried many different variations for the buttons and the click event handler.

Unfortunately, I'm not very handy with coding but I did everything exactly as shown in the post above (double checked it).

I also uploaded the .pvi files seperately on both methods.

Hope someone can offer me some help - really trying to get this going!

Thanks,

DF

smishra-31
5-Regular Member
(To:DFFHTW)

When you create .pvi files on Creo Illustrate, it appends "l-Creo 3D - "​ in starting of the name of your sequence.

So when you are passing JSON value in app params, pass it like this: [{"val":"l-Creo 3D - Figure 1.pvi"},{"val":"l-Creo 3D - Figure 2.pvi"}]

Don't forget to put ​.pvi​ extension at the end also..


mwassmann
5-Regular Member
(To:smishra-31)

it could be complete different names as well -

one secure way to find out is to open .pvz files in a zip app and see the filename - and use that filename.

Martin

DFFHTW
6-Contributor
(To:mwassmann)

I named it exactly after the pvi files i saw in Winrar, but it's not working either.

I would really like to achieve this with a dropdown menu.

Any other suggestions?

Thanks

mwassmann
5-Regular Member
(To:DFFHTW)

Can you export the project and share it with us please?

I tried it myself yesterday it was working perfectly fine - so there can only be a smaller issue in your project.

Martin

DFFHTW
6-Contributor
(To:mwassmann)

here's a onedrive link to the zip folder of the exported project:

https://1drv.ms/u/s!AqMw7LHgQ0OVrAJFpHZiEccKFxLW

thanks

smishra-31
5-Regular Member
(To:DFFHTW)

Hi Fabrik,

Please download this updated project from here:

fraes1_part_Updated.zip | Slack

What I can see that it seems like when we are setting a model sequence through dropdown menu it sets this name: I-Creo 3D - Abbildung 1.pvi & I-Creo 3D - Abbildung 2.pvi

​but what it actually looking for Abbildung 1.pvi​ & Abbildung 2.pvi

I am still not sure what the root cause. I am just assuming this that It might be due to name what we are giving and what studio is looking for.

I have done following changes:

1) anims app parameter value changes:    [{"val":"Abbildung 1"},{"val":"Abbildung 2"}]

2) New Filter to the binding of "['select-2']['value']" to model sequence:

          ​Name:    ​sequenceName

          Body:    return "l-Creo 3D - " + value + ".pvi";

3) Binding of button from "Play" to "Play All" of the model property.

Regards,

Shashank Mishra

mwassmann
5-Regular Member
(To:DFFHTW)

It is a typoe in your appparams.

the name of your pvi files have a typo in the first letter.

I just exchanged that to: [{"val":"l-Creo 3D - Abbildung 1.pvi"},{"val":"l-Creo 3D - Abbildung 2.pvi"}]

and it works. (the small letter in the front is a small L

Martin

hello martin

I am also facing the same issue i tried both ,in alternate 2 , in preview section i can see two options in drop down menu but when i click, it doesn't play the sequence. I think i have made some mistake. I have attached my project , find and help me solving it

mwassmann
5-Regular Member
(To:Naveen_sankar)

Naveen,

the issue in your experience is that you don't have a function that plays the sequences. (i recommend the tutorials on studio.thingworx.com or in the help of the application)

either you could take a button / or click on "something" as a function to play sequences - > or you use the value changed on the drop down menu and bind it to the play of the model-1.

It really depends on your use case.

Martin

DFFHTW
6-Contributor
(To:smishra-31)

I can't believe it!

I know the issue: a small "L" and a large "i" look exactly the same in Arial font.

Thank you very much for your help!

Regards,

DF

Hi all,
great combination for using multiple animations and Thingworx! Thanks!

To get this procedure more flexible:
Does anyone have an idea how to generate the list with the Figures (e.g. here
[{"val":"l-Creo 3D - Figure 1.pvi"},{"val":"l-Creo 3D - Figure 2.pvi"}] )

somehow automatically?

This would give the great possibility to reduce the manual work when working with different / multiple models from Illustrate

Greetings

Raphael

I found a little error in the documentation above where I specify the input arguments for the setWidgetProp function.

  • Figure 1.pvi is the value of the property. You should use one of the names of the pvi files inside the pvz (zip) file. The values that you see in the dropdown can be truncated! In my case the dropdown shows Figure 1 and the corresponding pvi file name inside the pvz is l-Creo 3D - Figure 1.pvi.
smishra-31
5-Regular Member
(To:mvonhasselbach)

Hi Moritz,

I have some queries would you please help me out in these ( Studio version: 8.0.3 😞

  1. My drop down list works only when I provide l-Creo 3D - Figure 1.pvi​ ​and not when I provide Figure 1​ ​in Application Parameter. why?
  2. My drop down list shows complete name of sequence i.e l-Creo 3D - Figure 1.pvi​ how can I truncate/limit it to just to show Figure 1​?
  3. How can I call a click event of a button in Home.JS after assigning a sequence to my model?

For ex:

     $scope.sequence1 = function() {

          $scope.view.wdg['model-1']['sequence'] = 'l-Creo 3D - Figure 1.pvi';

     }

Thank you

Shashank

smishra-31
5-Regular Member
(To:smishra-31)

Hi,

This is regarding my 2nd & 3rd query:

2nd Query​:    To resolve my 2nd query, I have done following steps:

    1. I have written simple "Figure 1" in Application Parameter(anims) as a JSON value. (No "l-Creo 3D" & no ".pvi" extension)
    2. I have added one filter to the binding between the "Value" property of "Select" Widget and "Sequence" of Model.

                                        Filter Details:

    • Filter Name: ​sequenceName
    • Filter Body:​ return "l-Creo 3D - " + value + ".pvi";

​3rd Query​:     In 3rd query, actually I wanted to assign a sequence to a model and than call a click event of a button. So that the assigned sequence could be played. (The button's click event would be binded to "PlayAll" service of model)

To achieve this functionality I have done some work around. Instead of calling button's click event I am calling "PlayAll" service of model.

For Ex:

$scope.sequence1 = function() {

     setTimeout(function() {

          $scope.$apply(function() {

                    $scope.view.wdg['model-1'].sequence = "Uploaded/l-Creo 3D - Figure 1.pvi";

                    angular.element(document.getElementById('model-1')).scope().playAll();

          });

     }, 6000);

}

The complete reference can be found at How to play all the Sequences (.pvi), one by one on a single click of a button?​ discussion.

Thank you,

Shashank

Top Tags