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

Model visibility / opacity in HoloLens Experience

BCAG_David
5-Regular Member

Model visibility / opacity in HoloLens Experience

Hello

 

I'm working on an HoloLens experience where I want to make some models invisible. Somehow it's not possible to change the visibility attribute of the models and also the forceHidden attribute does not work on the HoloLens...

 

I also tried it with the opacity all the following commands don't work neither. To check if its principally working I added the command to move the model on the z-axis and this works.

 

$scope.app.voiceHideSteelwork = function() {
voiceHideSteelwork();
}

function voiceHideSteelwork() {
$scope.setWidgetProp('model-1','z','0');

$scope.setWidgetProp('model-1','opacity','0.5');
$scope.view.wdg['model-1'].opacity = 0.5;
$scope.view.wdg['model-1']['opacity'] = 0.5;

$scope.setWidgetProp('modellItem-1','opacity','0.5');
$scope.view.wdg['modellItem-1'].opacity = 0.5;
$scope.view.wdg['modellItem-1']['opacity'] = 0.5;
}

 

Can somebody help me to make a model invisible?

 

Best regards

David

1 ACCEPTED SOLUTION

Accepted Solutions
BCAG_David
5-Regular Member
(To:RolandRaytchev)

Hi @RolandRaytchev 

 

Thanks a lot for the detailed informations and help.

While trying it out I discovered that I was to stupid to write "modelItem" correctly which was the issue.

With commands like $scope.setWidgetProp('modelItem-1','opacity','0.1'); it works fine.

 

Best regards

David

View solution in original post

2 REPLIES 2

Hi @BCAG_David ,

in generally  on HoloLens setting components as invisible should work – I think so far I remember I did this I the past.

What could be wrong in your case / without having a sample data for your case:

  • May be the model  has a sequence property which will override the status. You can unset on the model widget the sequence property and try then to set the opacity

 

$scope.setWidgetProp('model-1','sequence','');
//or
$scope.setWidgetProp('model-1','sequence',undefined)

 

  • I found an old project with the HoloLens where I called something like this:

 

$scope.setWidgetProp( target,  'color', "rgba(255,0,0,1.0)") 
$scope.setWidgetProp( target,  'opacity', 0.8)
$scope.$applyAsync();

 

the first line in  the code set the rgb color and the alpha channel  . The alpha channel has on some platform the same effects as setting transparency - but so far, I remember on the HoloLens is not a good idea to use value is not 1.0. There is better to use the opacity property. As last action we need to force the execution of the settings

  • another point is when the code was called. You need to check if the model /modelItem widgets are already loaded and active. E.g. calling the command from button or in the modelLoad event
  • You can use the hidden property.The following code to make items hidden  is working on HoloLens :
    $scope.$on('userpick', function(event,target,parent,edata)
     {  
       			 
     //-----
    
    if (edata) {
         try{
          console.log('edata');console.warn(edata);
    	  console.log("JSON.parse(edata)");console.warn(JSON.parse(edata));       
       	   	var pathid = JSON.parse(edata).occurrence;
    	    $scope.currentSelection = target + "-" + pathid;
    // this is the current selection - the selected component occurence
    // you can use it for example as shown below
         console.log("=>>"+$scope.currentSelection);
    	 
     tml3dRenderer.setProperties($scope.currentSelection, { hidden:true } ); 
         } catch (ea) {console.error("not twx-model is clicked but still fired")}		
        
      			} 
       else {
        	console.log('userpick evt w/o element data: '+ event.name + " target: " + target + " and parent:" + parent);
      				  } //edata
                }) //event on userpick                                              
                                         
    };​

    This code should blank a components which is selected on userpick - means when you click on it. You can blank an object without picking on it , when you know where the component is - in which model widget and what is the occurrence path of it -> example - when you have an component  with occurrence (this is modelItem  widget property) the same as path Id in Creo View = /0/1/3  and the component belongs to the model widget model-2 in this case you can blank it by calling:

    :

 

tml3dRenderer.setProperties('model-2-/0/1/3', { hidden:true } ); 

 

 

BCAG_David
5-Regular Member
(To:RolandRaytchev)

Hi @RolandRaytchev 

 

Thanks a lot for the detailed informations and help.

While trying it out I discovered that I was to stupid to write "modelItem" correctly which was the issue.

With commands like $scope.setWidgetProp('modelItem-1','opacity','0.1'); it works fine.

 

Best regards

David

View solution in original post

Announcements

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