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

Hide an array of objects

SOLVED
Highlighted
Amethyst

Hide an array of objects

I having trouble hiding a number of 3D image widgets. Rather than individually setting each of the widget's visibility to false, I tried to adding them to an array and then created a function which hides the array:

 

 

var clipCircles = [
  "circle1",
  "circle2",
  "circle3",
  "circle4",
  "circle5",
  "circle6",
  "circle7",
  "circle8",
  "circle9",
  "circle10",
  "circle11",
  "circle12",
  "circle13"
];

$scope.hideCircles = function() {
  for(var i=0; i< 13; i++){ 
	$scope.view.wdg[clipCircles[i]].visible = false;
  }
}

 

 

 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Hide an array of objects

Additionally, for the sake of completeness, I want to mention  you can try in the loop the following alternative call

1)calling after the setting an async apply

...
$scope.view.wdg['myCirlc']['vislble']=true;//false
$scope.$applyAsync();

 

2.) use the function  $scope.setWidgetProp() instead of the widget prop notation e.g. :

 

//generall usage of the method
//$scope.setWidgetProp('label-3',  'text',  "PREVIEW MODE");
//here in your context
$scope.hideCircles = function() {
  for(var i=0; i< 13; i++){ 
	//$scope.view.wdg[clipCircles[i]].visible = false;
$scope.setWidgetProp(clipCircles[i], 'visible',  false);
  }
}

 

3.) when the mentioned widget are modelItems widget - there could be an issue with some setting of sequence. This means using a sequence of the model will lock the properties  so that it will not react on setting of the visibility properties. In tis case you can try additionally try to set the forceHidden property:

 

$scope.setWidgetProp(wdgName,'forceHidden', true);
$scope.setWidgetProp(wdgName,'visible', false);
$scope.$applyAsync();
// and my be it back- not required
$scope.setWidgetProp(wdgName,'forceHidden', false);

 

4.)as mentioned in point 3.) the issue could be cause by sequence / step as mentioned in the post: "Model Item colors are not showing up in View"

There the issue is the color display , but the reason is still the same. You can try to unset as mentioned there, the sequence property

antoher relevant post is this

 

 

View solution in original post

3 REPLIES 3
Highlighted

Re: Hide an array of objects

here's how I did it directly addressing the 3dimage names....   all my images (6 in this case) had no visibility (deselected visible checkbox on each image widget props) then I call this function from a standard button, the code then makes that button into a toggle, click it once, all images show up, click it again, all the images go away.

 

 

var calloutVisibility = false;

$scope.toggleCalloutVisibility = function(){
if(calloutVisibility){
for(i = 1; i < 7; i++)
$scope.view.wdg['3DImage-' + i]['visible'] = false;
calloutVisibility = false;
} else {
for(i = 1; i < 7; i++)
$scope.view.wdg['3DImage-' + i]['visible'] = true;
calloutVisibility = true;
}
}

Highlighted

Re: Hide an array of objects

Additionally, for the sake of completeness, I want to mention  you can try in the loop the following alternative call

1)calling after the setting an async apply

...
$scope.view.wdg['myCirlc']['vislble']=true;//false
$scope.$applyAsync();

 

2.) use the function  $scope.setWidgetProp() instead of the widget prop notation e.g. :

 

//generall usage of the method
//$scope.setWidgetProp('label-3',  'text',  "PREVIEW MODE");
//here in your context
$scope.hideCircles = function() {
  for(var i=0; i< 13; i++){ 
	//$scope.view.wdg[clipCircles[i]].visible = false;
$scope.setWidgetProp(clipCircles[i], 'visible',  false);
  }
}

 

3.) when the mentioned widget are modelItems widget - there could be an issue with some setting of sequence. This means using a sequence of the model will lock the properties  so that it will not react on setting of the visibility properties. In tis case you can try additionally try to set the forceHidden property:

 

$scope.setWidgetProp(wdgName,'forceHidden', true);
$scope.setWidgetProp(wdgName,'visible', false);
$scope.$applyAsync();
// and my be it back- not required
$scope.setWidgetProp(wdgName,'forceHidden', false);

 

4.)as mentioned in point 3.) the issue could be cause by sequence / step as mentioned in the post: "Model Item colors are not showing up in View"

There the issue is the color display , but the reason is still the same. You can try to unset as mentioned there, the sequence property

antoher relevant post is this

 

 

View solution in original post

Highlighted

Re: Hide an array of objects

It seems that I overlooked that the widgets  are 3D Image widget's - in this case are only point 1 and 2 have relevance to the original questions, I am sorry! The points 3 and 4 are relevant to modeItem widgets.

Announcements
Join an
AR Working Group!

Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection