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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

tml3drenderer unhide a component

leonardosella
12-Amethyst

tml3drenderer unhide a component

In my project I could hide some component of the model and save into an array the hidden id, with: 

 

 var id_to_hide = $scope.app.cad.ModelID+'-'+$scope.app.cad.SelectedPartsID[0];
  	$scope.app.cad.idToUnhide.push(id_to_hide);
    
  	console.log('id_to_hide: ',id_to_hide);
    
  	$scope.app.cad.nohighlight(id_to_hide);
    tml3dRenderer.setProperties(id_to_hide,{hidden : true}); 

all is working fine. 

 

At the end of experience I want to restore all the component of the model, so I set up some code like this ad follow: 

$scope.clickReset = function() {
    console.log("clickReset")
  	
  	//funzione per ripristinare la posizione dei pezzi 
  	console.log($scope.app.cad.idToUnhide);
  	if($scope.app.cad.idToUnhide.length>0){
      console.log("entrato in if hide")
      for(j=0; j<$scope.app.cad.idToUnhide.length; j++){
          tml3dRenderer.setProperties($scope.app.cad.idToUnhide ,{hidden : false}); 
      }
    }

}

When I push the reset button in chrome console appear: 

app-runtime.js:778 Error evaluating buttonReset click JS: clickReset();
(anonymous) @ app-runtime.js:778
$emit @ ionic.bundle.min.js:178
$scope.fireEvent @ app-runtime.js:456
(anonymous) @ app-runtime.js:473
n @ ionic.bundle.min.js:22
t @ ionic.bundle.min.js:22
a @ ionic.bundle.min.js:22
ionic.bundle.min.js:150 TypeError: name.split is not a function
    at Object.GetObject (twx-mobile-widgets-3d-ng.js:854)
    at Object.setProperties (twx-mobile-widgets-3d-ng.js:1968)
    at m.$scope.clickReset (app.js?v1604068793157:765)
    at fn (eval at compile (ionic.bundle.min.js:260), <anonymous>:4:221)
    at m.$eval (ionic.bundle.min.js:176)
    at app-runtime.js:773
    at m.$emit (ionic.bundle.min.js:178)
    at m.$scope.fireEvent (app-runtime.js:456)
    at HTMLButtonElement.<anonymous> (app-runtime.js:473)
    at n (ionic.bundle.min.js:22)

 

Anyone has some help?

2 REPLIES 2

some think like :

 for(j=0; j<$scope.app.cad.idToUnhide.length; j++){
          tml3dRenderer.setProperties($scope.app.cad.idToUnhide[j] ,{hidden : false}); 
      }

I think it is array so you need the index, please, check 

but also possible to use the construct:

for(let iitem of $scope.app.cad.idToUnhide){
  tml3dRenderer.setProperties(item ,{hidden : false}); 
      }
$scope.$apply.Async();
Top Tags