Skip to main content
18-Opal
May 22, 2018
Solved

Modelitem visibility issue

  • May 22, 2018
  • 3 replies
  • 5950 views

Hi Folks--

I am having a strange problem with an experience. I have an experience with a model that has multiple sequences defined. The sequence is selected via UI items (buttons) and set via Javascript. All of that works fine.

However, I have several modelItems assigned to parts of the model, with toggle buttons to show/hide them. When I load the experience, all modelItems toggle on and off correctly. However, once I've selected and played a sequence, some of the modelItems still work to toggle on/off, but some don't. I've spent a fair amount of time looking at the modelItems to see if I can spot a difference between the ones that work in a sequence and the ones that don't. I can't find anything. I've checked their properties via Javascript debugging in the preview window, and things look as they should--the "visible" property dutifully switches between true and false, but the modelItems are not visible even when Javascript reports visible=true.

I also checked the model hierarchy, to make sure the faulty modelItems weren't child parts of something else that was hidden, but they are all top-level parts in the assembly.

Anyone have any ideas what else to check to explain why some modelItems would work in that context but others would not?

--Clay

Best answer by RolandRaytchev

For modelitems in a script I had a similar issue - so I set the visiblity to false or true but the modelitems did not follow the setting of the visiblity property . In my case the usage of 'forceHidden ' attribute did help. You can try.

Here an example:

 

// ModelLoaded event
$rootScope.$on('modelLoaded', function() {
 loadedCount++;
 if (loadedCount === 1) {
 ///////////////////////////////////////
 //Assign value to Application parameter defined in DATA
 $scope.app.params['counter'] = 0;
 console.log("modelLoaded");
 $scope.view.wdg['modelItem-door-aus']['forceHidden'] = true;
 $scope.view.wdg['modelItem-door-aus']['visible'] = true;
 $scope.view.wdg['slider-2']['value']=0;
 $scope.view.wdg['modelItem-door-aus']['forceHidden'] = false;
...

 

 

3 replies

1-Visitor
May 23, 2018

I have seen the exact same issues. It is slightly random as in some model items will "work" and respect the modelItem settings, but other modelItems will not. I have even seen one instance where just simply adding a model item "tag" to one particular part of my model will cause it's position during a sequence to change. The part is translated maybe 400mm from where it should be but then goes thru all the movements in the sequence with this translation offset and ends up in the wrong place at the end.

 

Another example is i was planning to use modelitem properties to highlight parts in an exploded view. So i have a sequence that explodes my assembly and then you can touch a  part to get info about that part. After the touch i wanted to highlight the selected part somehow. So i was just going to assign all parts modelitems and then after the touch on part X i could change the opacity on all other parts to something like 0.4 so part X stood out. In practice this does not work at all. Half the modelitems respect this opacity change and half do not. There is no obvious pattern to the ones that work and the ones that do not. You can confirm via debug or text labels that the opacity value of these modelitems is changing but it is not reflected in what you see.

 

Seems like the sequence and the modelitem are fighting for control of item properties.

18-Opal
May 23, 2018

Thanks! At least I know I'm not alone...

16-Pearl
May 30, 2018

I've also seen this behaviour.  As @jmikesell pointed out, the sequence and studio fight for control over the visibility of the part and from what I've observed the sequence wins out, unless you use the force hidden option as pointed out by @RolandRaytchev.

 

I've found that I often need to plan the visibility of items as I create the sequence in Creo Illustrate as to how that will look in AR and what I'm going to want to see/not see in AR.

21-Topaz I
May 23, 2018

For modelitems in a script I had a similar issue - so I set the visiblity to false or true but the modelitems did not follow the setting of the visiblity property . In my case the usage of 'forceHidden ' attribute did help. You can try.

Here an example:

 

// ModelLoaded event
$rootScope.$on('modelLoaded', function() {
 loadedCount++;
 if (loadedCount === 1) {
 ///////////////////////////////////////
 //Assign value to Application parameter defined in DATA
 $scope.app.params['counter'] = 0;
 console.log("modelLoaded");
 $scope.view.wdg['modelItem-door-aus']['forceHidden'] = true;
 $scope.view.wdg['modelItem-door-aus']['visible'] = true;
 $scope.view.wdg['slider-2']['value']=0;
 $scope.view.wdg['modelItem-door-aus']['forceHidden'] = false;
...

 

 

18-Opal
June 21, 2018

Thanks! I finally got back to this, and using forceHidden also helped for me.

--Clay

16-Pearl
August 28, 2018

No problems. Thanks Clay