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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Switching between Models Visibility Using Single Toggle Button

akanoo
6-Contributor

Switching between Models Visibility Using Single Toggle Button

The scenario:

I have 2 models namely Model1 and Model2. 

I want only model1 to be visible by default when the experience is loaded.

I have a toggle button, which when pressed, hides model1 and displays model2 and vice versa. 

 

Issues I am facing:

Both model1 and Model2 are visible initially.

I have tried binding toggle button property "Force Hide" to model2 which successfully keeps it hidden when the experience is loaded but upon clicking the toggle button it doesn't get visible. 

1 ACCEPTED SOLUTION

Accepted Solutions

hi,

 

It should work - does on my projects - so maybe something else is affecting the visibility? I would try to remove any code/bindings that affect visibility (like the Force Hide you mentioned)  and re-try.

 

If you still can't get it to work try in a new project:

1) Add a CAD model, set it to not be visible

2) Add a toggle button to your 2D view

3) Bind the button's "Pressed" property to the CAD model and select the Visible property.

That should be enough, good luck!

 

Patrick

 

View solution in original post

4 REPLIES 4

Hello,

 

You can set Model2 to not be visible - access the Details for the model and de-select the "Visible" checkbox.

It will now not be visible when the experience loads and you should be able to toggle visible/not visible with a button.

 

Hope this helps,

Patrick

Hello Patrick,

 

Thanks for the quick response.

 

As you asked, I unchecked the Model2 visibility property but it is still visible, both in preview and View app.

 

Maybe we need to override the settings by js code.  

JS code for Visible on clicked event and invisible on unclicked event.

hi,

 

It should work - does on my projects - so maybe something else is affecting the visibility? I would try to remove any code/bindings that affect visibility (like the Force Hide you mentioned)  and re-try.

 

If you still can't get it to work try in a new project:

1) Add a CAD model, set it to not be visible

2) Add a toggle button to your 2D view

3) Bind the button's "Pressed" property to the CAD model and select the Visible property.

That should be enough, good luck!

 

Patrick

 

Hello,

 

I think I have found the issue. 

When I don't select the sequence for the respective pvz, visibility issues doesn't come. 

But, when I select the sequence, the model2 is visible when the experience is loaded.

Announcements