Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
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...
Solved! Go to Solution.
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:
setWidgetProp( 'model-1', 'sequence', 'Figure 1.pvi');
where:
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!
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:
setWidgetProp( 'model-1', 'sequence', 'Figure 1.pvi');
where:
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.
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:
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!!!!
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
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.
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
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..
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
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
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
here's a onedrive link to the zip folder of the exported project:
https://1drv.ms/u/s!AqMw7LHgQ0OVrAJFpHZiEccKFxLW
thanks
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
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
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
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.
Hi Moritz,
I have some queries would you please help me out in these ( Studio version: 8.0.3 😞
For ex:
$scope.sequence1 = function() {
$scope.view.wdg['model-1']['sequence'] = 'l-Creo 3D - Figure 1.pvi';
}
Thank you
Shashank
Hi,
This is regarding my 2nd & 3rd query:
2nd Query: To resolve my 2nd query, I have done following steps:
Filter Details:
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