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

Adjusting Scale of a model with events

Highlighted
Level 5

Adjusting Scale of a model with events

Im attempting to scale the model by 0.1 with voice commands.

If I run "Decrease Engine Size" Voice command then "Increase Engine Size"  it works fine. 

reload and then

If I say command "Increase Engine Size" first it does not work and then "Decrease Engine Size" command doesn't work either. 

Any idea what I'm doing wrong?

 

Is there a better work flow?

scaling.PNG

4 REPLIES 4

Re: Adjusting Scale of a model with events

I have gone through few test scenarios and ran into the same thing. I need to look into this a bit further. 

Re: Adjusting Scale of a model with events

Hi,

Unfortunately, I don't have a HoloLens to test your example. Using only the preview it worked, but I understand that it is not working on the device. 

An alternative that you might try is:

Edit the <<ViewName.js>> and paste the following code:

 

$scope.SizeIncrease = function () {
  $scope.view.wdg['model-1']['scale'] = $scope.view.wdg['model-1']['scale'] + .1;
  $scope.$applyAsync(); } $scope.SizeDecrease = function () { $scope.view.wdg['model-1']['scale'] = $scope.view.wdg['model-1']['scale'] - .1;
  $scope.$applyAsync(); }

*** "model-1" should be replaced with the name of your model.

 

On the Decrease Engine Size JS event:

    viewCtrl.SizeDecrease();

 

On the Increase Engine Size JS event:
    viewCtrl.SizeDecrease();

With this method, you would not use the ScaleModel parameter and it's binding. 

I hope it helps! 

All the best,

Ricardo

Re: Adjusting Scale of a model with events

These steps worked for me...  (Edit from my original post).  After further testing, I'm running into the same issue where I have to say "Decrease Scale" prior to saying "Increase Scale".  Be nice if a solution was found for this little bug. 

 

 

 

 

Re: Adjusting Scale of a model with events

I wonder if maybe this is a variable type issue, where in some cases it interprets the parameter as a string rather than a number. Maybe give this a try:

$scope.SizeIncrease = function () {
  $scope.view.wdg['model-1']['scale'] = parseFloat($scope.view.wdg['model-1']['scale']) + 0.1;
  $scope.$applyAsync();
}
$scope.SizeDecrease = function () {
  $scope.view.wdg['model-1']['scale'] = parseFloat($scope.view.wdg['model-1']['scale']) - 0.1;
  $scope.$applyAsync();
}