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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to play a sequence without bindings button and model

leonardosella
13-Aquamarine

How to play a sequence without bindings button and model

Goodmorning everyone,
I would like to create an AR experience that reproduces animation sequences without having to link the "Play" button with the corresponding model.

Looking at the bottom panel in Vuforia Studio, the button-template link corresponds to the command: app.view ["Maintenance"]. Wdg ["cart"]. Svc.play.

How can I use it in the javascript file?

ACCEPTED SOLUTION

Accepted Solutions

 

 

I found this solution: 

 

 

$scope.sequencePlay = function () {
	$scope.$root.$broadcast('app.view["Maintenance"].wdg["carrello"].svc.play');
 };

 

 

 In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:

sequencePlay();

View solution in original post

5 REPLIES 5

Good morning Leonardosella,

 

  1. In View<View name>.js node (if View is named Home, node is named Home.js)
  2. Add a custom JavaScript function :

 

$scope.PlayMaintenanceSequnce = function () {
    console.log ("PlayMaintenanceSequnce");
    $scope.$root.$broadcast('app.view["Maintenance"].wdg["cart"].svc.play');
}

 

      3. In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:

 

PlayMaintenanceSequnce ();

 

 

Best regards,

Samuel

leonardosella
13-Aquamarine
(To:sdidier)

Thank you for your reply. 

 

I tried your code but didn't work. 

In the inspection tab appear the message into the screen above. 

 

Any suggestions?

 

Thank you. 

 

Hello Leonardosella,

 

I have updated code.

I did a bad copy and paste and I have missed to copy A into App instead of pp.

 

Added also $scope.$root.$broadcast who is needed.

 

Best regards,

Samuel

for the sake of completness here furhter addtional /alternative way's to play sequence via java code:

angular.element(document.getElementById('model-1')).scope().play(); 
// or for play all
angular.element(document.getElementById('model-1')).scope().playAll(); 

The code will be called in the current loaded view and will call the  play or playAll service of the Widget Id="model-1"

Here is also another way how to start a Widget service-> using the triggerWidgetService:

$scope.app.loadsequence = function()
	{ $scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/l-Creo 3D - TestFigure1.pvi"); 
 $timeout( function() {  
  twx.app.fn.triggerWidgetService("model-1", 'play'); 
                    }, 1000);	//delayed the play 1 sec
    };


 Here we set the sequence property first to a figure and after delay 1 sec will call the play service for the first step

 

 

I found this solution: 

 

 

$scope.sequencePlay = function () {
	$scope.$root.$broadcast('app.view["Maintenance"].wdg["carrello"].svc.play');
 };

 

 

 In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:

sequencePlay();
Announcements

Top Tags