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

Dynamic show/hide of model parts in Hololens

AndreaT
12-Amethyst

Dynamic show/hide of model parts in Hololens

Dear community,

in the company we'd like to start an internal process where we want to analyze the machine before building it.

So the request I've been asked is to be able to select and show/hide parts of the machine, but dynamically.

Our machines gets to be made of millions of parts, so it's not feasible to assign a model-item to each part.

I've seen this use case in the help center (http://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2Fmetadata%2FMetadata_201_Int...) and it would basically be the best solution, unless the described Use Case is for a smartphone/tablet and we'd like to make a step forward and have it done in HoloLens.

Just as a suggestion, before investing time, is it even possible to adapt that use case?

The functions would be:

- select a part

- highlight a part

- be able to select the father in order to also be able to hide assemblies

 

I don't need the search at the moment

 

I think this would be challenging, so this is the best place to ask for help 😁

3 REPLIES 3

I think this should be doable. You can start with some basic code to highlight a part when you tap on it:

// this handles user tap on an item
$scope.PART_HIGHLIGHT_COLOR = "rgba(255,0,0,1)";

$scope.$on('userpick', function (event, targetName, targetType, eventData) {
  // variable to pull the value for the occurrence property in the eventData JSON object from the model. Create variable for the currently selected part
  var pathId = JSON.parse(eventData).occurrence;
  // turn off previous highlight
  if ($scope.currentSelection) { 
    tml3dRenderer.setColor($scope.currentSelection, null);
  }
  // get new part and highligh
  $scope.currentSelection = targetName + "-" + pathId;
  tml3dRenderer.setColor($scope.currentSelection, $scope.PART_HIGHLIGHT_COLOR);
})

 Then you can add a button that selects the parent of the current selection, which would basically involve stripping the last "/##" from the end of the occurrence, something like this:

$scope.selectParent = function() {
  if ($scope.currentSelection.includes("/")) {
    // turn off previous highlight
    tml3dRenderer.setColor($scope.currentSelection, null);
    // strip off last entry in occurrence path
    $scope.currentSelection = $scope.currentSelection.replace(/(.*)\/\d+$/, "$1");
    // highlight new selection
    tml3dRenderer.setColor($scope.currentSelection, $scope.PART_HIGHLIGHT_COLOR);
  }
}

As for how to hide items without explicitly defined modelItems, I think there's probably a way to do so via tml3dRenderer, but I'm not sure exactly what it is. You might be able to work it out poking around in the VS javascript code or poking at the tml3dRenderer object in the browser debugger tools.

Hi @AndreaT ,

i think showing an assembly with millions of parts a very ambitious for Vuforia View on end device. I think what is working possibly on high end windows machine - will not work on devices with restricted power , or it will work with reasonable performance only on few devices (e.g. iPad Pro etc) Also memory is required - and possibly the download will also required a long time.

I think the code what @ClayHelberg posted is very good point to begin with your project. So clicking component in userpick event will provide the selected modelitem   path ( modelWidget +"/-"+component occurrence)   e.g. model-1-/0/0/9/4/1 where the model-1 is the name of the widget and /0/0/9/4/1 is the component occurrence . when the component selected is  model-1-/0/0/9/4/1  then it is contained by the next level component (rootassembyl or subassembly - here subassembly ) model-1-/0/0/9/4 ...  etc . So that omit one /... term will get the next upper level as @ClayHelberg  suggested.

One possible issue here  - I remember that in the past the behavior was when you blank (see attached simple project for blanking component without explicit  modelitem  widget definition )  an assembly - it was not able to blank the all subcomponets contained by the blanked (sub)/ assembly  component . Possibly is fixed already but if not then , please, let me know  to check it further. Thanks

Aha, so that's how you hide an object without a modelItem. Thanks @RolandRaytchev !

Announcements

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