Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hello,
I am trying to change the 'sequence' property of my 3Dmodel using JS for a HoloLens experience.
On the preview everything is ok, but on the Hololens itself the sequence is not switching.
The sequence itself is called "sequence" ("l-Creo 3D - sequence.pvi").
I tryed several approaches to reach the sequence:
$scope.setWidgetProp('staticModel', 'sequence', "app/resources/Uploaded/l-Creo 3D - sequence.pvi");
$scope.setWidgetProp('staticModel', 'sequence', "Uploaded/l-Creo 3D - sequence.pvi");
$scope.setWidgetProp('staticModel', 'sequence', "l-Creo 3D - sequence.pvi");
The interesting thing is, that all of these above is working in the preview.
But not with the HoloLens eventually.
I am using Creo Illustrate 4.2 and a single PVZ file is uploaded to the application resources in Studio.
Any help will be much appreciated.
Thanks!
Hi @IstvanPolacsek ,
I think the first thing what we need to verify is the sequence working on the HoloLens when we set it directly to the sequence property of the model widget. So means it should not work only in preview mode.
As second - I used in a test project successful the following code:
$scope.app.loadsequence = function() { $scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/l-Creo 3D - Figure1.pvi"); twx.app.fn.triggerWidgetService("model-1", 'play'); }; /////// $rootScope.$on('modelLoaded', function() {$scope.app.loadsequence(); console.warn("$scope.app.loadsequence() executed"); $timeout( function() { $scope.app.loadsequence(); console.warn("app.loadsequence() executed"); $scope.$applyAsync(); }, 1000); }); $scope.app.playsequence = function() { twx.app.fn.triggerWidgetService("model-1", 'play'); }; $scope.app.loadsequence1 = function() { $scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/l-Creo 3D - SecondFigure.pvi"); twx.app.fn.triggerWidgetService("model-1", 'playAll'); };
One important thing is to pay attention to call the setting of the sequence first when the model - widget is already loaded - also for instance when you change the displayed view
Another code where I know that was working :
var figure_list =["l-Creo 3D - Figure1","l-Creo 3D - Figure2","l-Creo - Figure3","l-Creo - Figure4"]; $scope.app.setSequence = function(val) { $scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/"+figure_list[val-1]+".pvi"); $scope.$applyAsync(); }; ... app.setSequnece(2); //sett the Figure2 ...
Hi @RolandRaytchev,
Answering your first comment, the sequences do work when I set them as model properties.
I think the problem is similar with the tag-along function:
On HoloLens these event simply not fire (for some reason).
I will look into the codes you provided and report about the results.
Hi @IstvanPolacsek ,
yes, I see there are some existing problems with the current version of vuforia view on the holoLens
- one I reported yesterday is the the general texture issue
- the tracking event : (not possible to retrive the the eyedir, eyepos and eyeup vectors) - I planed to report -hope today or tomorrow
- an now in this post - the issue is that playing of sequneces via js does not work- Here I need to verify first. Will test it today in the afternoon and if reproducible will report to R&D for the 8.4.2 -
I tested now to play sequences via javaScript as suggested on the HoloLens - Vuforia view 8.4.2. On the first time I could not verify that there is an issue with the setting playing of sequences on the HoloLens but I tested an old model which are create with older Creo Illustrate version. The following script was working:
//added the sequnece listener $scope.$on("sequenceloaded", function (evt, arg) { console.log("sequence loaded, starting play"); $scope.app.fn.triggerWidgetService("model-1","playAll");}); ////////////////////////////////// $rootScope.$on('modelLoaded', function() { $scope.app.test(); }); //////////////// $scope.app.test=function () { $timeout( function() {$scope.app.setSequence(1);} , 500); $scope.$applyAsync(); $timeout( function() { $scope.app.setSequence(2); }, 11000); $timeout( function() {twx.app.fn.triggerWidgetService("model-1", 'reset'); $scope.$applyAsync(); console.log("reset-4"); }, 20000); } //end of test var figure_list =["l-Creo 3D - TestFigure1","l-Creo 3D - SecondTestFigure"]; $scope.app.setSequence = function(val) { try{$scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/"+figure_list[val-1]+".pvi"); } catch(e) {console.warn("exception="+e);} $scope.$applyAsync(); };
My test was with a pvz model which was created in a older Creo Illustrate version . Because the sequences are some tests where I was not able to see very clearly the difference , I decided to recreate the pvz model with new sequences.For this task I used Creo Illustrate 5.1. Now the sequences are not working any more on HoloLens (in preview everything was ok) So I am not sure what is exactly the problem , but I believe that it will have problem with the Creo Illustrate 5.1 version. So I think I need to check more detailed what was the current supported Creo Illustrate version for the HoloLens…(I need to check the documentation and to perform some tests)
Hi @IstvanPolacsek,
A workaround to play multiple sequences is - extract the .pvi files and upload them separately on to the project. Once uploaded, use the resource path to activate the requested sequence:
$scope.view.wdg['model-1']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - ... .pvi';
Here is the sample JavaScript function for the same:
$scope.ChangeSequence = function(seq_name)
{
$scope.view.wdg['model-1']['sequence'] = 'app/resources/Uploaded/l-Creo 3D - ElbowMotorReplacement.pvi';
$timeout(function() {
$scope.$broadcast('app.view["Home"].wdg["model-1"].svc.playAll');
$scope.$applyAsync()
}
, 2000);
};
You would have to write separate functions for each sequence and link them in the Application Events as shown above.
Hope this helps!